Ejemplo n.º 1
0
 def parse_networks(self):
     """
     Parse all 'network' elements.
     """
     for network in xmlutils.iter_descendants_with_name(
             self.scenario, 'network'):
         self.parse_network(network)
Ejemplo n.º 2
0
 def parse_layer3_devices(self):
     """
     Parse all layer-3 device elements.  A device can be: 'host',
     'router'.
     """
     # TODO: suport generic 'device' elements
     for device in xmlutils.iter_descendants_with_name(self.scenario, self.layer3_device_types):
         self.parse_layer3_device(device)
Ejemplo n.º 3
0
 def find_device_with_interface(self, interface_id):
     # TODO: suport generic 'device' elements
     for device in xmlutils.iter_descendants_with_name(self.scenario, self.device_types):
         interface = xmlutils.get_first_child_with_attribute(device, 'interface', 'id', interface_id)
         if interface:
             if_name = interface.getAttribute('name')
             return device, if_name
     return None, None
Ejemplo n.º 4
0
 def parse_layer3_devices(self):
     """
     Parse all layer-3 device elements.  A device can be: 'host',
     'router'.
     """
     # TODO: suport generic 'device' elements
     for device in xmlutils.iter_descendants_with_name(self.scenario, self.layer3_device_types):
         self.parse_layer3_device(device)
Ejemplo n.º 5
0
 def find_device_with_interface(self, interface_id):
     # TODO: suport generic 'device' elements
     for device in xmlutils.iter_descendants_with_name(self.scenario, self.device_types):
         interface = xmlutils.get_first_child_with_attribute(device, 'interface', 'id', interface_id)
         if interface:
             if_name = interface.getAttribute('name')
             return device, if_name
     return None, None
Ejemplo n.º 6
0
 def parse_networks(self):
     """
     Parse all 'network' elements.
     """
     for network in xmlutils.iter_descendants_with_name(self.scenario, 'network'):
         self.parse_network(network)