diff --git a/framework/python/src/net_orc/network_validator.py b/framework/python/src/net_orc/network_validator.py index f82787af5..2a4112764 100644 --- a/framework/python/src/net_orc/network_validator.py +++ b/framework/python/src/net_orc/network_validator.py @@ -30,7 +30,7 @@ DEVICE_BRIDGE = 'tr-d' CONF_DIR = 'local' CONF_FILE = 'system.json' - +TR_CONTAINER_MAC_PREFIX = '9a:02:57:1e:8f:' class NetworkValidator: """Perform validation of network services.""" @@ -238,6 +238,10 @@ def _attach_device_to_network(self, device): util.run_command('ip link add ' + bridge_intf + ' type veth peer name ' + container_intf) + mac_addr = TR_CONTAINER_MAC_PREFIX + '10' + + util.run_command('ip link set dev ' + container_intf + ' address ' + mac_addr) + # Add bridge interface to device bridge util.run_command('ovs-vsctl add-port ' + DEVICE_BRIDGE + ' ' + bridge_intf) @@ -258,6 +262,7 @@ def _attach_device_to_network(self, device): util.run_command('ip netns exec ' + container_net_ns + ' ip link set dev ' + container_intf + ' name veth0') + # Set interfaces up util.run_command('ip link set dev ' + bridge_intf + ' up') util.run_command('ip netns exec ' + container_net_ns + diff --git a/modules/test/conn/python/src/connection_module.py b/modules/test/conn/python/src/connection_module.py index e9ec4946d..0143acc76 100644 --- a/modules/test/conn/python/src/connection_module.py +++ b/modules/test/conn/python/src/connection_module.py @@ -24,11 +24,12 @@ LOG_NAME = 'test_connection' LOGGER = None OUI_FILE = '/usr/local/etc/oui.txt' -DHCP_SERVER_CAPTURE_FILE = '/runtime/network/dhcp-1.pcap' STARTUP_CAPTURE_FILE = '/runtime/device/startup.pcap' MONITOR_CAPTURE_FILE = '/runtime/device/monitor.pcap' SLAAC_PREFIX = 'fd10:77be:4186' +TR_CONTAINER_MAC_PREFIX = '9a:02:57:1e:8f:' + class ConnectionModule(TestModule): """Connection Test module""" @@ -191,8 +192,7 @@ def _connection_single_ip(self): return result, 'No MAC address found.' # Read all the pcap files containing DHCP packet information - packets = rdpcap(DHCP_SERVER_CAPTURE_FILE) - packets.append(rdpcap(STARTUP_CAPTURE_FILE)) + packets = rdpcap(STARTUP_CAPTURE_FILE) packets.append(rdpcap(MONITOR_CAPTURE_FILE)) # Extract MAC addresses from DHCP packets @@ -200,9 +200,10 @@ def _connection_single_ip(self): LOGGER.info('Inspecting: ' + str(len(packets)) + ' packets') for packet in packets: # Option[1] = message-type, option 3 = DHCPREQUEST - if DHCP in packet and packet[DHCP].options[0][1] == 3: - mac_address = packet[Ether].src - mac_addresses.add(mac_address.upper()) + if DHCP in packet and packet[DHCP].options[0][1] == 3: + mac_address = packet[Ether].src + if not mac_address.startswith(TR_CONTAINER_MAC_PREFIX): + mac_addresses.add(mac_address.upper()) # Check if the device mac address is in the list of DHCPREQUESTs result = self._device_mac.upper() in mac_addresses