open-traffic-generator / snappi-ixnetwork

The Keysight IxNetwork implementation of the open-traffic-generator models.
MIT License
17 stars 11 forks source link

Getting Ethernet Eth1 not present within configuration error while executing vxlan sample #552

Closed selldinesh closed 2 years ago

selldinesh commented 2 years ago

Code Snippet

`

eth_1 = d1.ethernets.add()
eth_1.port_name = p1.name
eth_1.name = 'Ethernet1'
eth_1.mac = "00:14:0a:00:00:01"
ipv4_1 = eth_1.ipv4_addresses.add()
ipv4_1.name = 'IPv41'
ipv4_1.address = "220.0.1.2"
ipv4_1.gateway = "220.0.1.1"
ipv4_1.prefix = 24
bgp1 = config.devices[0].bgp
bgp1.router_id = "192.0.0.1"
bgp1_int = bgp1.ipv4_interfaces.add()
bgp1_int.ipv4_name = ipv4_1.name
bgp1_peer = bgp1_int.peers.add()
bgp1_peer.name = 'BGP1'
bgp1_peer.as_type = BGP_TYPE
bgp1_peer.peer_address = "220.0.1.1"
bgp1_peer.as_number = 200

#create and advertise loopback under bgp in d1
d1_l1 = d1.ipv4_loopbacks.add()
d1_l1.name = "IPv4 1"
d1_l1.eth_name = 'Eth1'
d1_l1.address = "221.0.1.1"
bgp1_l1 = bgp1_peer.v4_routes.add(name="NG_1")
bgp1_l1.addresses.add(address="221.0.1.1", prefix=32)
d1_vxlan = d1.vxlan.v4_tunnels.add()
d1_vxlan.vni = 1
d1_vxlan.source_interface = d1_l1.name
d1_vxlan.name = "VXLAN_1"

vtep = d1_vxlan.destination_ip_mode.unicast.vteps.add()
vtep.remote_vtep_address = "221.0.0.2"
vtep.arp_suppression_cache.add("00:16:01:00:00:01", "222.0.0.1")

edge_d1 = config.devices.device(name="Local")[-1]
edge_e1 = edge_d1.ethernets.ethernet()[-1]
edge_e1.connection.vxlan_name = d1_vxlan.name
edge_e1.name = "Ethernet_1" 
edge_e1.mac = "00:18:01:00:00:01"
edge_ip1 = edge_e1.ipv4_addresses.add()
edge_ip1.name = "IPv4_1"
edge_ip1.address = "222.0.0.1"
edge_ip1.gateway = "222.0.0.2"`

Error Output snappi/vxlan/test_vxlan_config.py:25:


snappi/vxlan/files/vxlan_helper.py:31: in create_vxlan run_vxlan_test(snappi_api,tgen_vxlan_config) snappi/vxlan/files/vxlan_helper.py:176: in run_vxlan_test snappi_api.set_config(vxlan_config)


self = <snappi_ixnetwork.snappi_api.Api object at 0x7fae38a23e90>, config = <snappi.snappi.Config object at 0x7fae38b1ce10>

def set_config(self, config):
    """Set or update the configuration"""
    try:
        if isinstance(config, (type(self._config_type), str)) is False:
            raise TypeError(
                "The content must be of type Union[Config, str]"
            )

        if isinstance(config, str) is True:
            config = self._config_type.deserialize(config)
        self.config_ixnetwork(config)
    except Exception as err:
      raise SnappiIxnException(err)

E SnappiIxnException: File "/var/johnar/.local/lib/python2.7/site-packages/snappi_ixnetwork/snappi_api.py", line 214, in set_config E self.config_ixnetwork(config) E File "/var/johnar/.local/lib/python2.7/site-packages/snappi_ixnetwork/snappi_api.py", line 261, in config_ixnetwork E self.ngpf.config() E File "/var/johnar/.local/lib/python2.7/site-packages/snappi_ixnetwork/device/ngpf.py", line 63, in config E self._configure_topology() E File "/var/johnar/.local/lib/python2.7/site-packages/snappi_ixnetwork/device/ngpf.py", line 111, in _configure_topology E self._configure_device_group(ixn_topos) E File "/var/johnar/.local/lib/python2.7/site-packages/snappi_ixnetwork/device/ngpf.py", line 202, in _configure_device_group E self.loopback_parent_dgs = self._loop_back.config() E File "/var/johnar/.local/lib/python2.7/site-packages/snappi_ixnetwork/device/loopbackint.py", line 19, in config E ipv4_loopbacks, device, vxlan_source_int_list E File "/var/johnar/.local/lib/python2.7/site-packages/snappi_ixnetwork/device/loopbackint.py", line 70, in _config_ipv4_loopbacks E ixn_dg = self._create_dg(ipv4_loopback, device) E File "/var/johnar/.local/lib/python2.7/site-packages/snappi_ixnetwork/device/loopbackint.py", line 54, in _create_dg E % eth_name) E Ethernet Eth1 not present within configuration

config = <snappi.snappi.Config object at 0x7fae38b1ce10> err = Exception('Ethernet Eth1 not present within configuration',) self = <snappi_ixnetwork.snappi_api.Api object at 0x7fae38a23e90>

../../.local/lib/python2.7/site-packages/snappi_ixnetwork/snappi_api.py:216: SnappiIxnException

selldinesh commented 2 years ago

The snippet executed fine first time, on executing the snippet for the second time was getting the following error