Beispiel #1
0
 def test_2_AllInterfaces(self):
     l_interfaces = nodesXml._read_interfaces_xml(self.m_xml.interface_sect)
     l_xml = nodesXml._write_interfaces_xml(l_interfaces)
     # print(PrettyFormatAny.form(l_xml, 'C1-2 All Interfaces'))
     self.assertEqual(l_xml[0].attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_0)
     self.assertEqual(l_xml[0].attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_0)
     self.assertEqual(l_xml[0].attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_0)
     self.assertEqual(l_xml[0][0].text, TESTING_NODES_INTERFACE_UUID_0_0)
     self.assertEqual(l_xml[0][1].text, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_0)
     self.assertEqual(l_xml[0][2].text, TESTING_NODES_INTERFACE_ADDRESS_V4_0_0)
     self.assertEqual(l_xml[0][3].text, TESTING_NODES_INTERFACE_ADDRESS_V6_0_0)
     self.assertEqual(l_xml[1].attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_1)
     self.assertEqual(l_xml[1].attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_1)
     self.assertEqual(l_xml[1].attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_1)
     self.assertEqual(l_xml[1][0].text, TESTING_NODES_INTERFACE_UUID_0_1)
     self.assertEqual(l_xml[1][1].text, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_1)
     self.assertEqual(l_xml[1][2].text, TESTING_NODES_INTERFACE_ADDRESS_V4_0_1)
     self.assertEqual(l_xml[1][3].text, TESTING_NODES_INTERFACE_ADDRESS_V6_0_1)
     self.assertEqual(l_xml[2].attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_2)
     self.assertEqual(l_xml[2].attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_2)
     self.assertEqual(l_xml[2].attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_2)
     self.assertEqual(l_xml[2][0].text, TESTING_NODES_INTERFACE_UUID_0_2)
     self.assertEqual(l_xml[2][1].text, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_2)
     self.assertEqual(l_xml[2][2].text, TESTING_NODES_INTERFACE_ADDRESS_V4_0_2)
     self.assertEqual(l_xml[2][3].text, TESTING_NODES_INTERFACE_ADDRESS_V6_0_2)
Beispiel #2
0
 def test_04_AllNodes(self):
     l_nodes = nodesXml.read_all_nodes_xml(self.m_pyhouse_obj)
     # print(PrettyFormatAny.form(l_nodes, 'C1-04-A All Nodes'))
     self.m_pyhouse_obj.Computer.Nodes = l_nodes
     l_xml, l_count = nodesXml.write_nodes_xml(self.m_pyhouse_obj)
     # print(PrettyFormatAny.form(l_xml, 'C1-04-B All Nodes'))
     self.assertEqual(l_count, 2)
Beispiel #3
0
 def test_03_OneNode(self):
     l_node = nodesXml._read_one_node_xml(self.m_xml.node)
     l_xml = nodesXml._write_one_node_xml(l_node)
     print(PrettyFormatAny.form(l_xml, 'All Interfaces'))
     self.assertEqual(l_xml.attrib['Name'], 'pi-01')
     self.assertEqual(l_xml.attrib['Key'], '0')
     self.assertEqual(l_xml.attrib['Active'], 'True')
Beispiel #4
0
 def test_01_OneInterface(self):
     l_interface = nodesXml._read_one_interface_xml(self.m_xml.interface)
     l_xml = nodesXml._write_one_interface_xml(l_interface)
     print(PrettyFormatAny.form(l_xml, 'One Interface'))
     self.assertEqual(l_xml.attrib['Name'], 'eth0')
     self.assertEqual(l_xml.attrib['Key'], '0')
     self.assertEqual(l_xml.attrib['Active'], 'True')
Beispiel #5
0
 def test_1_OneInterface(self):
     l_interface = nodesXml._read_one_interface_xml(self.m_xml.interface)
     l_xml = nodesXml._write_one_interface_xml(l_interface)
     # print(PrettyFormatAny.form(l_xml, 'C1-1 One Interface'))
     self.assertEqual(l_xml.attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_0)
     self.assertEqual(l_xml.attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_0)
     self.assertEqual(l_xml.attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_0)
     self.assertEqual(l_xml[0].text, TESTING_NODES_INTERFACE_UUID_0_0)
     self.assertEqual(l_xml[1].text, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_0)
     self.assertEqual(l_xml[2].text, TESTING_NODES_INTERFACE_ADDRESS_V4_0_0)
     self.assertEqual(l_xml[3].text, TESTING_NODES_INTERFACE_ADDRESS_V6_0_0)
Beispiel #6
0
 def test_03_OneNode(self):
     l_node = nodesXml._read_one_node_xml(self.m_xml.node)
     l_xml = nodesXml._write_one_node_xml(l_node)
     # print(PrettyFormatAny.form(l_xml, 'C1-03-A - One Node'))
     self.assertEqual(l_xml.attrib['Name'], TESTING_NODES_NODE_NAME_0)
     self.assertEqual(l_xml.attrib['Key'], TESTING_NODES_NODE_KEY_0)
     self.assertEqual(l_xml.attrib['Active'], TESTING_NODES_NODE_ACTIVE_0)
     self.assertEqual(l_xml.find('UUID').text, TESTING_NODES_NODE_UUID_0)
     # self.assertEqual(l_xml[1].text, TESTING_NODES_CONNECTION_ADDRESS_V4_0)
     # self.assertEqual(l_xml[2].text, TESTING_NODES_CONNECTION_ADDRESS_V6_0)
     self.assertEqual(l_xml.find('NodeRole').text, TESTING_NODES_NODE_ROLL_0)
Beispiel #7
0
 def test_3_OneNode(self):
     l_node = nodesXml._read_one_node_xml(self.m_xml.node)
     l_xml = nodesXml._write_one_node_xml(l_node)
     # print(PrettyFormatAny.form(l_xml, 'C1-3-A One Node'))
     # print(PrettyFormatAny.form(l_xml[4][0], 'C1-3-B One Node 4-0'))
     self.assertEqual(l_xml.attrib['Name'], TESTING_NODES_NODE_NAME_0)
     self.assertEqual(l_xml.attrib['Key'], TESTING_NODES_NODE_KEY_0)
     self.assertEqual(l_xml.attrib['Active'], TESTING_NODES_NODE_ACTIVE_0)
     self.assertEqual(l_xml[0].text, TESTING_NODES_NODE_UUID_0)
     self.assertEqual(l_xml[1].text, TESTING_NODES_CONNECTION_ADDRESS_V4_0)
     self.assertEqual(l_xml[2].text, TESTING_NODES_CONNECTION_ADDRESS_V6_0)
     self.assertEqual(l_xml[3].text, TESTING_NODES_NODE_ROLL_0)
Beispiel #8
0
 def test_01_OneInterface(self):
     l_interface = nodesXml._read_one_interface_xml(self.m_xml.interface)
     l_xml = nodesXml._write_one_interface_xml(l_interface)
     # print(PrettyFormatAny.form(l_xml, 'C1-01-A -  One Interface'))
     self.assertEqual(l_xml.attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_0)
     self.assertEqual(l_xml.attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_0)
     self.assertEqual(l_xml.attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_0)
     self.assertEqual(l_xml.find('UUID').text, TESTING_NODES_INTERFACE_UUID_0_0)
     self.assertEqual(l_xml.find('InterfaceType').text, TESTING_NODES_INTERFACE_TYPE_0_0)
     self.assertEqual(l_xml.find('MacAddress').text, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_0)
     self.assertEqual(l_xml.find('IPv4Address').text, TESTING_NODES_INTERFACE_ADDRESS_V4_0_0)
     self.assertEqual(l_xml.find('IPv6Address').text, TESTING_NODES_INTERFACE_ADDRESS_V6_0_0)
Beispiel #9
0
 def LoadXml(self, p_pyhouse_obj):
     """ Load the Mqtt xml info.
     """
     self.m_pyhouse_obj = p_pyhouse_obj
     l_nodes = nodesXml.read_all_nodes_xml(p_pyhouse_obj)
     p_pyhouse_obj.Computer.Nodes = l_nodes
     return l_nodes
Beispiel #10
0
 def test_03_OneNode(self):
     l_node = nodesXml._read_one_node_xml(self.m_xml.node)
     print(PrettyFormatAny.form(l_node, 'One Node'))
     self.assertEqual(l_node.Name, TESTING_NODES_NODE_NAME_0, 'Bad Name')
     self.assertEqual(l_node.Key, 0, 'Bad Key')
     self.assertEqual(l_node.Active, True, 'Bad Active')
     self.assertEqual(l_node.NodeRole, 0, 'Bad NodeRole')
Beispiel #11
0
 def test_02_AllInterfaces(self):
     l_interfaces = nodesXml._read_interfaces_xml(self.m_xml.interface_sect)
     # print(PrettyFormatAny.form(l_interfaces, 'B1-02-A - Interfaces'))
     self.assertEqual(len(l_interfaces), 3)
     self.assertEqual(l_interfaces[0].Name, TESTING_NODES_INTERFACE_NAME_0_0)
     self.assertEqual(l_interfaces[1].Name, TESTING_NODES_INTERFACE_NAME_0_1)
     self.assertEqual(l_interfaces[2].Name, TESTING_NODES_INTERFACE_NAME_0_2)
Beispiel #12
0
 def test_03_Node_0(self):
     l_node = nodesXml._read_one_node_xml(self.m_xml.node)
     # print(PrettyFormatAny.form(l_node, 'B1-03-A - One Node', 108))
     self.assertEqual(l_node.Name, TESTING_NODES_NODE_NAME_0)
     self.assertEqual(l_node.Key, int(TESTING_NODES_NODE_KEY_0))
     self.assertEqual(l_node.Active, bool(TESTING_NODES_NODE_ACTIVE_0))
     self.assertEqual(l_node.NodeRole, int(TESTING_NODES_NODE_ROLL_0))
Beispiel #13
0
 def test_3_Node_0(self):
     print(PrettyFormatAny.form(self.m_xml.node, 'B1-3-A One Node XML'))
     l_node = nodesXml._read_one_node_xml(self.m_xml.node)
     print(PrettyFormatAny.form(l_node, 'B1-3-B One Node', 108))
     self.assertEqual(l_node.Name, TESTING_NODES_NODE_NAME_0)
     self.assertEqual(l_node.Key, int(TESTING_NODES_NODE_KEY_0))
     self.assertEqual(l_node.Active, bool(TESTING_NODES_NODE_ACTIVE_0))
     self.assertEqual(l_node.NodeRole, int(TESTING_NODES_NODE_ROLL_0))
Beispiel #14
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     l_web = webXml.read_web_xml(self.m_pyhouse_obj)
     self.m_pyhouse_obj.Computer.Web = l_web
     l_nodes = nodesXml.read_all_nodes_xml(self.m_pyhouse_obj)
     self.m_pyhouse_obj.Computer.Nodes = l_nodes
     self.m_worksapce = WorkspaceData
     self.m_worksapce.m_pyhouse_obj = self.m_pyhouse_obj
Beispiel #15
0
 def setUp(self):
     SetupMixin.setUp(self, ET.fromstring(XML_LONG))
     l_web = webXml.read_web_xml(self.m_pyhouse_obj)
     self.m_pyhouse_obj.Computer.Web = l_web
     l_nodes = nodesXml.read_all_nodes_xml(self.m_pyhouse_obj)
     self.m_pyhouse_obj.Computer.Nodes = l_nodes
     self.m_worksapce = WorkspaceData
     self.m_worksapce.m_pyhouse_obj = self.m_pyhouse_obj
Beispiel #16
0
 def test_5_AllNodes(self):
     l_nodes = nodesXml.read_all_nodes_xml(self.m_pyhouse_obj)
     print(PrettyFormatAny.form(l_nodes, 'B1-5 All Nodes', 108))
     # print(PrettyFormatAny.form(l_nodes[TESTING_NODES_NODE_NAME_0], 'Node 0', 10))
     # print(PrettyFormatAny.form(l_nodes[TESTING_NODES_NODE_NAME_0].NodeInterfaces, 'All Nodes', 10))
     self.assertEqual(len(l_nodes), 2)
     self.assertEqual(l_nodes[TESTING_NODES_NODE_UUID_0].Name, TESTING_NODES_NODE_NAME_0)
     self.assertEqual(l_nodes[TESTING_NODES_NODE_UUID_1].Name, TESTING_NODES_NODE_NAME_1)
Beispiel #17
0
 def test_02_AllInterfaces(self):
     l_interfaces = nodesXml._read_interfaces_xml(self.m_xml.interface_sect)
     print(PrettyFormatAny.form(l_interfaces, 'Interfaces'))
     self.assertEqual(len(l_interfaces), 3)
     self.assertEqual(l_interfaces[0].Name, TESTING_NODES_INTERFACE_NAME_0_0, 'Bad Name')
     self.assertEqual(l_interfaces[1].Name, TESTING_NODES_INTERFACE_NAME_0_1, 'Bad Name')
     self.assertEqual(l_interfaces[2].Name, 'lo', 'Bad Name')
     self.assertEqual(len(l_interfaces), 3, 'Wrong interface count.')
Beispiel #18
0
 def test_04_Node_1(self):
     l_ix = self.m_xml.node_sect[1]
     # print(PrettyFormatAny.form(l_ix, 'B1-04-A One Node XML'))
     l_node = nodesXml._read_one_node_xml(l_ix)
     # print(PrettyFormatAny.form(l_node, 'B1-04-B One Node', 108))
     self.assertEqual(l_node.Name, TESTING_NODES_NODE_NAME_1)
     self.assertEqual(l_node.Key, int(TESTING_NODES_NODE_KEY_1))
     self.assertEqual(l_node.Active, bool(TESTING_NODES_NODE_ACTIVE_1))
     self.assertEqual(l_node.NodeRole, int(TESTING_NODES_NODE_ROLL_1))
Beispiel #19
0
 def test_01_OneInterface(self):
     l_interface = nodesXml._read_one_interface_xml(self.m_xml.interface)
     print(PrettyFormatAny.form(l_interface, 'Interface'))
     self.assertEqual(l_interface.Name, TESTING_NODES_INTERFACE_NAME_0_0, 'Bad Name')
     self.assertEqual(l_interface.Key, int(TESTING_NODES_INTERFACE_KEY_0_0), 'Bad Key')
     self.assertEqual(l_interface.Active, bool(TESTING_NODES_INTERFACE_ACTIVE_0_0), 'Bad Active')
     self.assertEqual(l_interface.MacAddress, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_0, 'Bad MacAddress')
     self.assertEqual(l_interface.V4Address, TESTING_NODES_INTERFACE_ADDRESS_V4_0_0, 'Bad V4Address')
     self.assertEqual(l_interface.V6Address, TESTING_NODES_INTERFACE_ADDRESS_V6_0_0)
Beispiel #20
0
 def test_02_Who(self):
     l_node = nodesXml._read_one_node_xml(self.m_xml.node)
     # print(PrettyFormatAny.form(l_node, 'C1-01-A - Node'))
     l_json = json_tools.encode_json(l_node)
     # print(PrettyFormatAny.form(l_json, 'C1-01-B - PyHouse'))
     l_msg = json_tools.decode_json_unicode(l_json)
     Util.add_node(self.m_pyhouse_obj, l_msg)
     # print(PrettyFormatAny.form(self.m_pyhouse_obj.Computer.Nodes, 'C1-01-C - PyHouse'))
     self.assertNotEqual(self.m_pyhouse_obj.Xml, TESTING_NODES_NODE_NAME_0)
Beispiel #21
0
 def test_02_Who(self):
     l_node = nodesXml._read_one_node_xml(self.m_xml.node)
     # print(PrettyFormatAny.form(l_node, 'C1-01-A - Node'))
     l_json = json_tools.encode_json(l_node)
     # print(PrettyFormatAny.form(l_json, 'C1-01-B - PyHouse'))
     l_msg = json_tools.decode_json_unicode(l_json)
     Util.add_node(self.m_pyhouse_obj, l_msg)
     # print(PrettyFormatAny.form(self.m_pyhouse_obj.Computer.Nodes, 'C1-01-C - PyHouse'))
     self.assertNotEqual(self.m_pyhouse_obj.Xml, TESTING_NODES_NODE_NAME_0)
Beispiel #22
0
 def test_4_Node_1(self):
     l_ix = self.m_xml.node_sect[1]
     print(PrettyFormatAny.form(l_ix, 'B1-4-A One Node XML'))
     l_node = nodesXml._read_one_node_xml(l_ix)
     print(PrettyFormatAny.form(l_node, 'B1-4-B One Node', 108))
     self.assertEqual(l_node.Name, TESTING_NODES_NODE_NAME_1)
     self.assertEqual(l_node.Key, int(TESTING_NODES_NODE_KEY_1))
     self.assertEqual(l_node.Active, bool(TESTING_NODES_NODE_ACTIVE_1))
     self.assertEqual(l_node.NodeRole, int(TESTING_NODES_NODE_ROLL_1))
Beispiel #23
0
 def test_1_OneInterface(self):
     l_interface = nodesXml._read_one_interface_xml(self.m_xml.interface)
     # print(PrettyFormatAny.form(l_interface, 'Interface'))
     self.assertEqual(l_interface.Name, TESTING_NODES_INTERFACE_NAME_0_0)
     self.assertEqual(l_interface.Key, int(TESTING_NODES_INTERFACE_KEY_0_0))
     self.assertEqual(l_interface.Active, bool(TESTING_NODES_INTERFACE_ACTIVE_0_0))
     self.assertEqual(l_interface.UUID, TESTING_NODES_INTERFACE_UUID_0_0)
     self.assertEqual(l_interface.NodeInterfaceType, TESTING_NODES_INTERFACE_TYPE_0_0)
     self.assertEqual(l_interface.MacAddress, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_0)
     self.assertEqual(l_interface.V4Address, TESTING_NODES_INTERFACE_ADDRESS_V4_0_0)
     self.assertEqual(l_interface.V6Address, TESTING_NODES_INTERFACE_ADDRESS_V6_0_0)
Beispiel #24
0
 def test_4_AllNodes(self):
     l_nodes = nodesXml.read_all_nodes_xml(self.m_pyhouse_obj)
     print(PrettyFormatAny.form(l_nodes, 'C1-4-A All Nodes'))
     self.m_pyhouse_obj.Computer.Nodes = l_nodes
     l_xml, l_count = nodesXml.write_nodes_xml(self.m_pyhouse_obj)
     print(PrettyFormatAny.form(l_xml, 'C1-4-B All Nodes'))
     self.assertEqual(l_count, 2)
     self.assertEqual(l_xml[0].attrib['Name'], TESTING_NODES_NODE_NAME_1)
     self.assertEqual(l_xml[1].attrib['Name'], TESTING_NODES_NODE_NAME_0)
     self.assertEqual(l_xml[0].attrib['Key'], TESTING_NODES_NODE_KEY_1)
     self.assertEqual(l_xml[1].attrib['Key'], TESTING_NODES_NODE_KEY_0)
     self.assertEqual(l_xml[1].attrib['Active'], TESTING_NODES_NODE_ACTIVE_0)
     self.assertEqual(l_xml[4][0].attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_0)
     self.assertEqual(l_xml[4][0].attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_0)
     self.assertEqual(l_xml[4][0].attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_0)
     self.assertEqual(l_xml[4][1].attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_1)
     self.assertEqual(l_xml[4][1].attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_1)
     self.assertEqual(l_xml[4][1].attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_1)
     self.assertEqual(l_xml[4][2].attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_2)
     self.assertEqual(l_xml[4][2].attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_2)
     self.assertEqual(l_xml[4][2].attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_2)
     self.assertEqual(l_xml[1][0].text, TESTING_NODES_NODE_UUID_0)
Beispiel #25
0
 def test_01_OneInterface(self):
     """ Test that the entire NodeInterface() obj is built properly
     """
     l_interface = nodesXml._read_one_interface_xml(self.m_xml.interface)
     # print(PrettyFormatAny.form(l_interface, 'B1-01-A - Interface'))
     self.assertEqual(l_interface.Name, TESTING_NODES_INTERFACE_NAME_0_0)
     self.assertEqual(l_interface.Key, int(TESTING_NODES_INTERFACE_KEY_0_0))
     self.assertEqual(l_interface.Active, bool(TESTING_NODES_INTERFACE_ACTIVE_0_0))
     self.assertEqual(l_interface.UUID, TESTING_NODES_INTERFACE_UUID_0_0)
     self.assertEqual(l_interface.NodeInterfaceType, TESTING_NODES_INTERFACE_TYPE_0_0)
     self.assertEqual(l_interface.MacAddress, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_0)
     self.assertEqual(l_interface.V4Address, TESTING_NODES_INTERFACE_ADDRESS_V4_0_0)
     self.assertEqual(l_interface.V6Address, TESTING_NODES_INTERFACE_ADDRESS_V6_0_0)
Beispiel #26
0
 def test_02_AllInterfaces(self):
     l_interfaces = nodesXml._read_interfaces_xml(self.m_xml.interface_sect)
     l_xml = nodesXml._write_interfaces_xml(l_interfaces)
     # print(PrettyFormatAny.form(l_xml, 'C1-02-A - All Interfaces'))
     self.assertEqual(l_xml[0].attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_0)
     self.assertEqual(l_xml[0].attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_0)
     self.assertEqual(l_xml[0].attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_0)
     self.assertEqual(l_xml[0].find('UUID').text, TESTING_NODES_INTERFACE_UUID_0_0)
     self.assertEqual(l_xml[0].find('MacAddress').text, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_0)
     # self.assertEqual(l_xml[0][2].text, TESTING_NODES_INTERFACE_ADDRESS_V4_0_0)
     # self.assertEqual(l_xml[0][3].text, TESTING_NODES_INTERFACE_ADDRESS_V6_0_0)
     self.assertEqual(l_xml[1].attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_1)
     self.assertEqual(l_xml[1].attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_1)
     self.assertEqual(l_xml[1].attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_1)
     self.assertEqual(l_xml[1].find('UUID').text, TESTING_NODES_INTERFACE_UUID_0_1)
     self.assertEqual(l_xml[1].find('MacAddress').text, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_1)
     # self.assertEqual(l_xml[1][2].text, TESTING_NODES_INTERFACE_ADDRESS_V4_0_1)
     # self.assertEqual(l_xml[1][3].text, TESTING_NODES_INTERFACE_ADDRESS_V6_0_1)
     self.assertEqual(l_xml[2].attrib['Name'], TESTING_NODES_INTERFACE_NAME_0_2)
     self.assertEqual(l_xml[2].attrib['Key'], TESTING_NODES_INTERFACE_KEY_0_2)
     self.assertEqual(l_xml[2].attrib['Active'], TESTING_NODES_INTERFACE_ACTIVE_0_2)
     self.assertEqual(l_xml[2].find('UUID').text, TESTING_NODES_INTERFACE_UUID_0_2)
     self.assertEqual(l_xml[2].find('MacAddress').text, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_2)
Beispiel #27
0
 def test_2_AllInterfaces(self):
     l_interfaces = nodesXml._read_interfaces_xml(self.m_xml.interface_sect)
     # print(PrettyFormatAny.form(l_interfaces, 'Interfaces'))
     self.assertEqual(len(l_interfaces), 3)
     self.assertEqual(l_interfaces[0].Name, TESTING_NODES_INTERFACE_NAME_0_0)
     self.assertEqual(l_interfaces[0].Key, int(TESTING_NODES_INTERFACE_KEY_0_0))
     self.assertEqual(l_interfaces[0].Active, bool(TESTING_NODES_INTERFACE_ACTIVE_0_0))
     self.assertEqual(l_interfaces[0].UUID, TESTING_NODES_INTERFACE_UUID_0_0)
     self.assertEqual(l_interfaces[0].NodeInterfaceType, TESTING_NODES_INTERFACE_TYPE_0_0)
     self.assertEqual(l_interfaces[0].MacAddress, TESTING_NODES_INTERFACE_MAC_ADDRESS_0_0)
     self.assertEqual(l_interfaces[0].V4Address, TESTING_NODES_INTERFACE_ADDRESS_V4_0_0)
     self.assertEqual(l_interfaces[0].V6Address, TESTING_NODES_INTERFACE_ADDRESS_V6_0_0)
     self.assertEqual(l_interfaces[1].Name, TESTING_NODES_INTERFACE_NAME_0_1)
     self.assertEqual(l_interfaces[2].Name, TESTING_NODES_INTERFACE_NAME_0_2)
     self.assertEqual(len(l_interfaces), 3)
Beispiel #28
0
 def SaveXml(self, p_xml):
     l_xml = nodesXml.write_nodes_xml(self.m_pyhouse_obj.Computer.Nodes)
     p_xml.append(l_xml)
     LOG.info("Saved XML.")
     return l_xml  #  For testing
Beispiel #29
0
 def LoadXml(self, p_pyhouse_obj):
     """ Load the Mqtt xml info.
     """
     l_nodes = nodesXml.read_all_nodes_xml(p_pyhouse_obj)
     return l_nodes
Beispiel #30
0
 def SaveXml(self, p_xml):
     l_xml, l_count = nodesXml.write_nodes_xml(self.m_pyhouse_obj)
     p_xml.append(l_xml)
     LOG.info("Saved XML for {} nodes.".format(l_count))
     return l_xml  # For testing
Beispiel #31
0
 def test_02_AllInterfaces(self):
     l_interfaces = nodesXml._read_interfaces_xml(self.m_xml.interface_sect)
     l_xml = nodesXml._write_interfaces_xml(l_interfaces)
     print(PrettyFormatAny.form(l_xml, 'All Interfaces'))
Beispiel #32
0
 def test_04_AllNodes(self):
     l_nodes = nodesXml.read_all_nodes_xml(self.m_pyhouse_obj)
     l_xml = nodesXml.write_nodes_xml(l_nodes)
     print(PrettyFormatAny.form(l_xml, 'All Interfaces'))
Beispiel #33
0
 def test_04_AllNodes(self):
     l_nodes = nodesXml.read_all_nodes_xml(self.m_pyhouse_obj)
     print(PrettyFormatAny.form(l_nodes, 'All Nodes', 10))
     print(PrettyFormatAny.form(l_nodes[0], 'Node 0', 10))
     print(PrettyFormatAny.form(l_nodes[0].NodeInterfaces, 'All Nodes', 10))
     self.assertEqual(len(l_nodes), 2)
Beispiel #34
0
 def test_05_AllNodes(self):
     l_nodes = nodesXml.read_all_nodes_xml(self.m_pyhouse_obj)
     # print(PrettyFormatAny.form(l_nodes, 'B1-05-A - All Nodes', 108))
     self.assertEqual(len(l_nodes), 2)
     self.assertEqual(l_nodes[TESTING_NODES_NODE_UUID_0].Name, TESTING_NODES_NODE_NAME_0)
     self.assertEqual(l_nodes[TESTING_NODES_NODE_UUID_1].Name, TESTING_NODES_NODE_NAME_1)