Ejemplo n.º 1
0
 def test_create_node_port_5(self):
     # verify the creation of port if local_link is in-valid
     logger.warn('TESTING %s', self.id())
     qfx1_name = self.id() + 'qfx1'
     node_name = self.id() + '-node'
     pr_and_pi = {qfx1_name: ['xe-0/0/0', 'xe-0/0/1', 'xe-0/0/2',
                              'xe-0/0/3', 'xe-0/0/4']}
     self.create_qfx_and_pi(pr_and_pi)
     port_details = {'name': 'port1', 'address': "11:22:33:44:55:55",
                     'sw_name': qfx1_name, 'port_id': 'xe-0/0/5'}
     node_and_port = {node_name: [port_details]}
     try:
         node_obj = Node(node_name, node_hostname=node_name)
         self.api.node_create(node_obj)
         ll_obj = LocalLinkConnection(
             switch_info=port_details.get('sw_name'),
             port_id=port_details.get('port_id'))
         bm_info = BaremetalPortInfo(address=port_details.get('address'),
                                     local_link_connection=ll_obj)
         node_port_obj = Port(port_details.get('name'), node_obj,
                              bms_port_info=bm_info)
         self.api.port_create(node_port_obj)
         self.remove_qfx_and_pi(pr_and_pi)
         self.remove_node_and_port(node_and_port)
     except Exception as e:
         logger.warn('Port Test 5 : FAILED ' + str(e))
         self.remove_qfx_and_pi(pr_and_pi)
         self.remove_node_and_port(node_and_port)
     logger.warn('PASS - Port Created')
Ejemplo n.º 2
0
    def test_create_node_port_8(self):
        logger.warn('TESTING %s', self.id())
        # verify the update of port with empty local_link by moving to a new PI
        qfx1_name = self.id() + 'qfx1'
        node_name = self.id() + '-node'
        pr_and_pi = {qfx1_name: ['xe-0/0/0',
                                 'xe-0/0/1',
                                 'xe-0/0/2',
                                 'xe-0/0/3',
                                 'xe-0/0/4']}
        self.create_qfx_and_pi(pr_and_pi)
        node_and_port = {
            node_name: [{'name': 'port1', 'address': "11:22:33:44:55:55"}]
        }
        port_details = {'name': 'port1', 'address': "11:22:33:44:55:55",
                        'sw_name': qfx1_name, 'port_id': 'xe-0/0/2'}
        new_node_port = {node_name: [port_details]}
        try:
            verify_result = False
            self.create_node_and_port(node_and_port)
            ll_obj = LocalLinkConnection(
                switch_info=port_details.get('sw_name'),
                port_id=port_details.get('port_id'))
            bm_info = BaremetalPortInfo(
                address=port_details.get('address'),
                local_link_connection=ll_obj)
            port_read_obj = self.api.port_read(
                fq_name=['default-global-system-config', node_name, 'port1'])
            port_read_obj.set_bms_port_info(bm_info)
            logger.warn('BEFORE PORT UPDATED ')
            self.api.port_update(port_read_obj)
            logger.warn('PORT UPDATED ')
            for node in new_node_port:
                for port in new_node_port[node]:
                    logger.warn('verify port ' + node + ' => ' + port['name'])
                    verify_result = False
                    port_fq_name = ['default-global-system-config',
                                    node,
                                    port.get('name')]
                    pi_fq_name = ['default-global-system-config',
                                  port.get('sw_name'),
                                  port.get('port_id')]
                    verify_result = self.verify_port_pi_ref(port_fq_name,
                                                            pi_fq_name)
                    logger.warn('ALL Good 1 ' + str(verify_result))
                    self.assertEqual(True, verify_result)

            self.remove_qfx_and_pi(pr_and_pi)
            self.remove_node_and_port(node_and_port)
        except Exception as e:
            logger.warn('TEST FAILED ' + str(e))
            self.assertEqual(True, verify_result)
            self.remove_qfx_and_pi(pr_and_pi)
            self.remove_node_and_port(node_and_port)
        logger.warn('PASS - Port Created')
Ejemplo n.º 3
0
 def create_node_and_port(self, node_and_port):
     for node in node_and_port:
         node_obj = EndSystem(node, node_hostname=node)
         self.api.end_system_create(node_obj)
         for port in node_and_port[node]:
             logger.warn(port['name'])
             ll_obj = None
             if port.get('sw_name') and port.get('port_id'):
                 ll_obj = LocalLinkConnection(
                     switch_info=port.get('sw_name'),
                     port_id=port.get('port_id'))
             bm_info = BaremetalPortInfo(address=port.get('address'),
                                         local_link_connection=ll_obj)
             node_port_obj = Port(port.get('name'),
                                  node_obj,
                                  bms_port_info=bm_info)
             self.api.port_create(node_port_obj)