Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model bgpsrte restruct #172

Merged
merged 18 commits into from
Oct 1, 2021
Merged

Model bgpsrte restruct #172

merged 18 commits into from
Oct 1, 2021

Conversation

SuryyaKrJana
Copy link
Contributor

@SuryyaKrJana SuryyaKrJana commented Sep 24, 2021

https://redocly.github.io/redoc/?url=https://raw.githubusercontent.com/open-traffic-generator/models/model_bgpsrte_restruct/artifacts/openapi.yaml

While working PR#154 at the end , we have found SRTE needs a refactoring a bit. We discussed in the scrum and found no body right now using SRTE model. All agreed to disable in SRTE from top level (BGP Peer) and merged PR#154 to master to progress Controller and Rustic working together. That’s testing is going on. Btw, I have created another PR#172 for SRTE Model modification. It is backward compatible to PR#154.

Previous PR: https://github.com/open-traffic-generator/models/pull/154

#Snappi and Json code examples.

#Snappi code example.
import otg
#Two ports with DUT, each port running ISIS and BGP SRTE over IPv4.

#Creating Ports
api = otg.api(location="https://localhost")
config = api.config()
p1 = config.ports.port(name='p1', location='172.17.0.2:50071')[-1]
p2 = config.ports.port(name='p2', location='172.17.0.3:50071')[-1]

#Create ISIS running on connected interface.
p1_d1 = config.devices.device(name='p1_d1')[-1]

p1_eth1 = p1_d1.ethernets.ethernet(port_name=p1.name)[-1]
p1_eth1.name = 'p1_eth1'
p1_eth1.mac = '64:00:00:00:00:01'
p1_eth1.vlans.vlan(name='p1_vlan1', id=100)[-1]
p1_ip1 = p1_eth1.ipv4_addresses.ipv4(name = 'p1_ip1', address = '20.20.20.2', gateway = '20.20.20.1')[-1]

p1_isisRtr1 = p1_d1.isis
p1_isisRtr1.name='p1_d1_isis'
p1_isisRtr1.system_id='640000000001'
p1_isisRtr1.advanced.area_addresses = ["490001","490002" ]

p1_isisInf1 = p1_isisRtr1.interfaces.interface(eth_name=p1_eth1.name, network_type='broadcast')[-1]
p1_isisInf1.level_type = p1_isisInf1.LEVEL_2
l2 = p1_isisInf1.l2_settings
l2.priority = 100
l2.hello_interval = 1000

p1_isisInf1.link_protection.extra_traffic = False
p1_isisInf1.link_protection.shared = True
p1_isisInf1.multi_topology_ids.mt(mt_id=2, link_metric=20)[-1]
p1_te1 = p1_isisInf1.traffic_engineering.te(administrative_group='0100000', metric_level=20)[-1]
priorities = p1_te1.priority_bandwidths_0_7
priorities.pb0 = 2500000
priorities.pb1 = 2550000

#ISIS Route range advertising loopback of change device.
v4rr1 = p1_isisRtr1.v4_routes.v4routerange(name='rr1')[-1]
v4rr1.addresses.v4routeaddress(address='1.1.1.1', prefix=32, count=1, step=1)[-1]

#Emulate BGP running on chained/unconnected device.
p1_d2 = config.devices.device(name='p1_unconn')[-1]
p1_lo1 = p1_d1.ipv4_loopbacks.ipv4loopback(eth_name=p1_eth1.name, name='p1_lo1', address = '1.1.1.1')[-1]

# Creating a BGP Ipv4 peer on the connected interface.
p1_d2.bgp.router_id = '1.1.1.1'
p1_bgpv4Iface = p1_d2.bgp.ipv4_interfaces.v4interface(ipv4_name=p1_lo1.name)[-1]
p1_bgpPeer1 = p1_bgpv4Iface.peers.v4peer(name='p1_peer1', peer_address='10.10.10.10', as_type='ibgp', as_number=100)[-1]

p1_v4rr = p1_bgpPeer1.v4_routes.v4routerange(name='p1_rr1')[-1]
p1_v4rr.addresses.v4routeaddress(address='100.10.1.1', prefix=24, count=2, step=2)[-1]
 

p1_v6rr = p1_bgpPeer1.v6_routes.v6routerange(name='p1_rr2')[-1]
p1_v6rr.addresses.v6routeaddress(address='1000:1:1:1::1', prefix=56, count=2, step=2)[-1]
p1_v6rr.next_hop_mode = "manual"

p1_bgpPeer1.capability.ipv4_sr_te_policy = True
p1_srtev4_policy = p1_bgpPeer1.v4_srte_policies.v4policy(name='policy1', ipv4_endpoint='100.100.10.1')[-1]

srte_tunnel = p1_srtev4_policy.tunnel_tlvs.v4tunneltlv(name='tunnel1')[-1]
srte_tunnel.policy_name_sub_tlv.policy_name = "srte_test"
srte_tunnel.policy_priority_sub_tlv.policy_priority = 100
segmentlist = srte_tunnel.segment_lists.segmentlist(name='segmentlis1')[-1]
segment1 = segmentlist.segments.segment(name='seg-1', segment_type='type_a')[-1]
segment1.type_a.label = 1000

segment2 = segmentlist.segments.segment(name='seg1', segment_type='type_a')[-1]
segment2.type_a.label = 2000


#Create ISIS running on connected interface.
p2_d1 = config.devices.device(name='p2_d1')[-1]

p2_eth1 = p2_d1.ethernets.ethernet(port_name=p2.name)[-1]
p2_eth1.name = 'p2_eth1'
p2_eth1.mac = '65:00:00:00:00:01'
p2_eth1.vlans.vlan(name='p2_vlan1', id=100)[-1]
p2_ip1 = p1_eth1.ipv4_addresses.ipv4(name = 'p2_ip1', address = '30.30.30.2', gateway = '30.30.30.1')[-1]

p2_isisRtr1 = p2_d1.isis
p2_isisRtr1.name='p2_d1_isis'
p2_isisRtr1.system_id='650000000001'
p2_isisInf1 = p2_isisRtr1.interfaces.interface(eth_name=p2_eth1.name, network_type='broadcast')[-1]
p2_isisInf1.link_protection.extra_traffic - False

#ISIS Route range advertising loopback of change device.
p2_v4rr1 = p2_isisRtr1.v4_routes.v4routerange(name='p2_rr1')[-1]
p2_v4rr1.addresses.v4routeaddress(address='2.2.2.2', prefix=32, count=1, step=1)[-1]

#Emulate BGP running on chained/unconnected device.
p2_d2 = config.devices.device(name='p2_unconn')[-1]
p2_lo1 = p2_d2.ipv4_loopbacks.ipv4loopback(eth_name=p2_eth1.name, name='p2_lo1', address = '2.2.2.2')[-1]

# Creating a BGP Ipv4 peer on the connected interface.
p2_d2.bgp.router_id = '2.2.2.2'
p2_bgpv4Iface = p2_d2.bgp.ipv4_interfaces.v4interface(ipv4_name=p2_lo1.name)[-1]
p2_bgpPeer1 = p2_bgpv4Iface.peers.v4peer(name='p2_peer1', peer_address='10.10.10.10', as_type='ibgp', as_number=100)[-1]
p2_v4rr = p2_bgpPeer1.v4_routes.v4routerange(name='p2_rr1')[-1]
p2_v4rr.addresses.v4routeaddress(address='200.10.1.1', prefix=24, count=2, step=2)[-1]
p2_v6rr = p2_bgpPeer1.v6_routes.v6routerange(name='p2_rr2')[-1]
p2_v6rr.addresses.v6routeaddress(address='2000:1:1:1::1', prefix=64, count=2, step=2)[-1]

p2_bgpPeer1.capability.ipv4_sr_te_policy = True

#Example of accessing BGP route ranges from Flow End Point.
flow1 = config.flows.flow(name='f1')[-1]
flow1.tx_rx.device.tx_names = [p1_v4rr.name, p1_v6rr.name]
flow1.tx_rx.device.rx_names = [p2_v4rr.name, p2_v6rr.name]

proto_state = api.protocol_state()
proto_state.state = proto_state.STOP

print(config.serialize())
print(proto_state.serialize())
{
  "devices": [
    {
      "ethernets": [
        {
          "ipv4_addresses": [
            {
              "address": "20.20.20.2",
              "gateway": "20.20.20.1",
              "name": "p1_ip1",
              "prefix": 24
            },
            {
              "address": "30.30.30.2",
              "gateway": "30.30.30.1",
              "name": "p2_ip1",
              "prefix": 24
            }
          ],
          "mac": "64:00:00:00:00:01",
          "mtu": 1500,
          "name": "p1_eth1",
          "port_name": "p1",
          "vlans": [
            {
              "id": 100,
              "name": "p1_vlan1",
              "priority": 0,
              "tpid": "x8100"
            }
          ]
        }
      ],
      "ipv4_loopbacks": [
        {
          "address": "1.1.1.1",
          "eth_name": "p1_eth1",
          "name": "p1_lo1"
        }
      ],
      "isis": {
        "advanced": {
          "area_addresses": [
            "490001",
            "490002"
          ],
          "csnp_interval": 10000,
          "enable_hello_padding": true,
          "lsp_lifetime": 1200,
          "lsp_mgroup_min_trans_interval": 5000,
          "lsp_refresh_rate": 600,
          "max_area_addresses": 3,
          "max_lsp_size": 1492,
          "psnp_interval": 2000
        },
        "interfaces": [
          {
            "eth_name": "p1_eth1",
            "l2_settings": {
              "dead_interval": 30,
              "hello_interval": 1000,
              "priority": 100
            },
            "level_type": "level_2",
            "link_protection": {
              "dedicated_1_plus_1": false,
              "dedicated_1_to_1": false,
              "enhanced": false,
              "extra_traffic": false,
              "reserved_40": false,
              "reserved_80": false,
              "shared": true,
              "unprotected": false
            },
            "metric": 10,
            "multi_topology_ids": [
              {
                "link_metric": 20,
                "mt_id": 2
              }
            ],
            "network_type": "broadcast",
            "traffic_engineering": [
              {
                "administrative_group": "0100000",
                "max_bandwith": 125000000,
                "max_reservable_bandwidth": 125000000,
                "metric_level": 20,
                "priority_bandwidths_0_7": {
                  "pb0": 2500000,
                  "pb1": 2550000,
                  "pb2": 125000000,
                  "pb3": 125000000,
                  "pb4": 125000000,
                  "pb5": 125000000,
                  "pb6": 125000000,
                  "pb7": 125000000
                }
              }
            ]
          }
        ],
        "name": "p1_d1_isis",
        "system_id": "640000000001",
        "v4_routes": [
          {
            "addresses": [
              {
                "address": "1.1.1.1",
                "count": 1,
                "prefix": 32,
                "step": 1
              }
            ],
            "link_metric": 0,
            "n_flag": false,
            "name": "rr1",
            "r_flag": false,
            "redistribution": "up",
            "route_origin": "internal",
            "x_flag": false
          }
        ]
      },
      "name": "p1_d1"
    },
    {
      "bgp": {
        "ipv4_interfaces": [
          {
            "ipv4_name": "p1_lo1",
            "peers": [
              {
                "as_number": 100,
                "as_number_width": "four",
                "as_type": "ibgp",
                "capability": {
                  "evpn": false,
                  "extended_next_hop_encoding": false,
                  "ipv4_mdt": false,
                  "ipv4_mpls_vpn": false,
                  "ipv4_multicast": false,
                  "ipv4_multicast_mpls_vpn": false,
                  "ipv4_multicast_vpn": false,
                  "ipv4_sr_te_policy": true,
                  "ipv4_unicast": true,
                  "ipv4_unicast_add_path": false,
                  "ipv4_unicast_flow_spec": false,
                  "ipv6_mdt": false,
                  "ipv6_mpls_vpn": false,
                  "ipv6_multicast": false,
                  "ipv6_multicast_mpls_vpn": false,
                  "ipv6_multicast_vpn": false,
                  "ipv6_sr_te_policy": false,
                  "ipv6_unicast": true,
                  "ipv6_unicast_add_path": false,
                  "ipv6_unicast_flow_spec": false,
                  "link_state_non_vpn": false,
                  "link_state_vpn": false,
                  "route_constraint": false,
                  "route_refresh": true,
                  "vpls": false
                },
                "name": "p1_peer1",
                "peer_address": "10.10.10.10",
                "v4_routes": [
                  {
                    "addresses": [
                      {
                        "address": "100.10.1.1",
                        "count": 2,
                        "prefix": 24,
                        "step": 2
                      }
                    ],
                    "name": "p1_rr1",
                    "next_hop_address_type": "ipv4",
                    "next_hop_ipv4_address": "0.0.0.0",
                    "next_hop_ipv6_address": "::0",
                    "next_hop_mode": "local_ip"
                  }
                ],
                "v4_srte_policies": [
                  {
                    "active": true,
                    "color": 100,
                    "distinguisher": 1,
                    "ipv4_endpoint": "100.100.10.1",
                    "name": "policy1",
                    "next_hop_address_type": "ipv4",
                    "next_hop_mode": "local_ip",
                    "tunnel_tlvs": [
                      {
                        "active": true,
                        "name": "tunnel1",
                        "policy_name_sub_tlv": {
                          "policy_name": "srte_test"
                        },
                        "policy_priority_sub_tlv": {
                          "policy_priority": 100
                        },
                        "segment_lists": [
                          {
                            "active": true,
                            "name": "segmentlis1",
                            "segments": [
                              {
                                "active": true,
                                "name": "seg-1",
                                "segment_type": "type_a",
                                "type_a": {
                                  "flags": 0,
                                  "label": 1000
                                }
                              },
                              {
                                "active": true,
                                "name": "seg1",
                                "segment_type": "type_a",
                                "type_a": {
                                  "flags": 0,
                                  "label": 2000
                                }
                              }
                            ]
                          }
                        ]
                      }
                    ]
                  }
                ],
                "v6_routes": [
                  {
                    "addresses": [
                      {
                        "address": "1000:1:1:1::1",
                        "count": 2,
                        "prefix": 56,
                        "step": 2
                      }
                    ],
                    "name": "p1_rr2",
                    "next_hop_address_type": "ipv6",
                    "next_hop_ipv4_address": "0.0.0.0",
                    "next_hop_ipv6_address": "::0",
                    "next_hop_mode": "manual"
                  }
                ]
              }
            ]
          }
        ],
        "router_id": "1.1.1.1"
      },
      "name": "p1_unconn"
    },
    {
      "ethernets": [
        {
          "mac": "65:00:00:00:00:01",
          "mtu": 1500,
          "name": "p2_eth1",
          "port_name": "p2",
          "vlans": [
            {
              "id": 100,
              "name": "p2_vlan1",
              "priority": 0,
              "tpid": "x8100"
            }
          ]
        }
      ],
      "isis": {
        "interfaces": [
          {
            "eth_name": "p2_eth1",
            "level_type": "level_2",
            "link_protection": {
              "dedicated_1_plus_1": false,
              "dedicated_1_to_1": false,
              "enhanced": false,
              "extra_traffic": false,
              "reserved_40": false,
              "reserved_80": false,
              "shared": false,
              "unprotected": false
            },
            "metric": 10,
            "network_type": "broadcast"
          }
        ],
        "name": "p2_d1_isis",
        "system_id": "650000000001",
        "v4_routes": [
          {
            "addresses": [
              {
                "address": "2.2.2.2",
                "count": 1,
                "prefix": 32,
                "step": 1
              }
            ],
            "link_metric": 0,
            "n_flag": false,
            "name": "p2_rr1",
            "r_flag": false,
            "redistribution": "up",
            "route_origin": "internal",
            "x_flag": false
          }
        ]
      },
      "name": "p2_d1"
    },
    {
      "bgp": {
        "ipv4_interfaces": [
          {
            "ipv4_name": "p2_lo1",
            "peers": [
              {
                "as_number": 100,
                "as_number_width": "four",
                "as_type": "ibgp",
                "capability": {
                  "evpn": false,
                  "extended_next_hop_encoding": false,
                  "ipv4_mdt": false,
                  "ipv4_mpls_vpn": false,
                  "ipv4_multicast": false,
                  "ipv4_multicast_mpls_vpn": false,
                  "ipv4_multicast_vpn": false,
                  "ipv4_sr_te_policy": true,
                  "ipv4_unicast": true,
                  "ipv4_unicast_add_path": false,
                  "ipv4_unicast_flow_spec": false,
                  "ipv6_mdt": false,
                  "ipv6_mpls_vpn": false,
                  "ipv6_multicast": false,
                  "ipv6_multicast_mpls_vpn": false,
                  "ipv6_multicast_vpn": false,
                  "ipv6_sr_te_policy": false,
                  "ipv6_unicast": true,
                  "ipv6_unicast_add_path": false,
                  "ipv6_unicast_flow_spec": false,
                  "link_state_non_vpn": false,
                  "link_state_vpn": false,
                  "route_constraint": false,
                  "route_refresh": true,
                  "vpls": false
                },
                "name": "p2_peer1",
                "peer_address": "10.10.10.10",
                "v4_routes": [
                  {
                    "addresses": [
                      {
                        "address": "200.10.1.1",
                        "count": 2,
                        "prefix": 24,
                        "step": 2
                      }
                    ],
                    "name": "p2_rr1",
                    "next_hop_address_type": "ipv4",
                    "next_hop_ipv4_address": "0.0.0.0",
                    "next_hop_ipv6_address": "::0",
                    "next_hop_mode": "local_ip"
                  }
                ],
                "v6_routes": [
                  {
                    "addresses": [
                      {
                        "address": "2000:1:1:1::1",
                        "count": 2,
                        "prefix": 64,
                        "step": 2
                      }
                    ],
                    "name": "p2_rr2",
                    "next_hop_address_type": "ipv6",
                    "next_hop_ipv4_address": "0.0.0.0",
                    "next_hop_ipv6_address": "::0",
                    "next_hop_mode": "local_ip"
                  }
                ]
              }
            ]
          }
        ],
        "router_id": "2.2.2.2"
      },
      "ipv4_loopbacks": [
        {
          "address": "2.2.2.2",
          "eth_name": "p2_eth1",
          "name": "p2_lo1"
        }
      ],
      "name": "p2_unconn"
    }
  ],
  "flows": [
    {
      "name": "f1",
      "tx_rx": {
        "choice": "device",
        "device": {
          "mode": "mesh",
          "rx_names": [
            "p2_rr1",
            "p2_rr2"
          ],
          "tx_names": [
            "p1_rr1",
            "p1_rr2"
          ]
        }
      }
    }
  ],
  "ports": [
    {
      "location": "172.17.0.2:50071",
      "name": "p1"
    },
    {
      "location": "172.17.0.3:50071",
      "name": "p2"
    }
  ]
}
{
  "state": "stop"
}

@SuryyaKrJana SuryyaKrJana marked this pull request as ready for review September 24, 2021 19:23
Copy link
Contributor

@apratimmukherjee apratimmukherjee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general , looks good to me. Only one attribute related clarification needed for local_preference i.e. whether we can have a default working mode for iBGP use-case which is the default and extra option to not include it optionally for eBGP. Rest are all related to descriptions.

device/bgp/bgpsrteadvanced.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrteadvanced.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtebindingsubtlv.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtepolicycolorsubtlv.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtepolicynamesubtlv.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtev4remoteendpointsubtlv.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtev6remoteendpointsubtlv.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtev6remoteendpointsubtlv.yaml Outdated Show resolved Hide resolved
device/bgp/bgpv4srtepolicy.yaml Outdated Show resolved Hide resolved
device/bgp/bgpv6srtepolicy.yaml Outdated Show resolved Hide resolved
@ankur-sheth
Copy link
Contributor

What issue or enhancement is this PR addressing? Can we link the PR to it? And is this change backwards incompatible?

@PrasenjitAdhikary
Copy link
Contributor

@manomugdha

@SuryyaKrJana
Copy link
Contributor Author

What issue or enhancement is this PR addressing? Can we link the PR to it? And is this change backwards incompatible?

https://github.com/open-traffic-generator/models/pull/154
While working PR#154 at the end , we have found SRTE needs a refactoring a bit. We discussed in the scrum and found no body right now using SRTE model. All agreed to disabled in SRTE from top label and merged PR#154 to master to progress Controller and Rustic working together. That’s testing is going on. Btw, I have created another PR#172 for SRTE Model modification. It is backward compatible to PR#154.

@apratimmukherjee apratimmukherjee self-requested a review September 25, 2021 13:00
device/bgp/bgp.yaml Outdated Show resolved Hide resolved
device/bgp/bgp.yaml Outdated Show resolved Hide resolved
Copy link
Contributor Author

@SuryyaKrJana SuryyaKrJana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@SuryyaKrJana saw your comments. Answers my questions. I'm ok to take this in. You don't need to wait for my review. I would expect that BGP domain experts are reviewing in more detail.

Noted.

@apratimmukherjee
Copy link
Contributor

apratimmukherjee commented Sep 27, 2021 via email

device/bgp/bgp.yaml Outdated Show resolved Hide resolved
device/bgp/bgp.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrteadvanced.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrteadvanced.yaml Outdated Show resolved Hide resolved
device/bgp/bgpexcommunity.yaml Outdated Show resolved Hide resolved
device/bgp/bgpexcommunity.yaml Outdated Show resolved Hide resolved
device/bgp/bgp.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtebindingsubtlv.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtebindingsubtlv.yaml Show resolved Hide resolved
Copy link
Contributor

@ashutshkumr ashutshkumr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of it is a documentation change, and I believe can be addressed as a separate bugfix.

device/bgp/bgp.yaml Outdated Show resolved Hide resolved
device/bgp/bgp.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtev4policy.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtev4policy.yaml Show resolved Hide resolved
device/bgp/bgpsrtev4policy.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtev4policy.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrteadvanced.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtev4policy.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrtev4policy.yaml Outdated Show resolved Hide resolved
device/bgp/bgpsrteadvanced.yaml Outdated Show resolved Hide resolved
@ashutshkumr
Copy link
Contributor

@ajbalogh do you have any ideas on how to fix multiline comments involving bullets ? In redocly they all seem to appear as a single line making it harder to read the text. Maybe we could work out some rule for writing descriptions (and enhance bundler accordingly) ?

@ajbalogh
Copy link
Contributor

@ashutshkumr I agree we should come up with a standard for representing descriptions.
Currently there is a hook in the bundler to format descriptions which can be extended (see bundler.py def literatal_representer).

@SuryyaKrJana SuryyaKrJana merged commit 1f88fc8 into master Oct 1, 2021
@SuryyaKrJana SuryyaKrJana deleted the model_bgpsrte_restruct branch October 1, 2021 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants