Exemplo n.º 1
0
    def _verify_show_network_details(self):
            # Verification - get raw result from db
            nw = db.network_list(self.tenant_id)[0]
            network = {'id': nw.uuid,
                       'name': nw.name,
                       'op-status': nw.op_status}
            port_list = db.port_list(nw.uuid)
            if not port_list:
                network['ports'] = [
                    {'id': '<none>',
                     'state': '<none>',
                     'attachment': {
                     'id': '<none>', }, }, ]
            else:
                network['ports'] = []
                for port in port_list:
                    network['ports'].append({
                        'id': port.uuid,
                        'state': port.state,
                        'attachment': {
                            'id': port.interface_id or '<none>', }, })

            # Fill CLI template
            output = cli.prepare_output('show_net_detail',
                                        self.tenant_id,
                                        dict(network=network),
                                        self.version)
            # Verify!
            # Must add newline at the end to match effect of print call
            self.assertEquals(self.fake_stdout.make_string(), output + '\n')
Exemplo n.º 2
0
 def _verify_list_networks_details(self):
         # Verification - get raw result from db
         nw_list = db.network_list(self.tenant_id)
         networks = [dict(id=nw.uuid, name=nw.name) for nw in nw_list]
         # Fill CLI template
         output = cli.prepare_output('list_nets_detail',
                                     self.tenant_id,
                                     dict(networks=networks),
                                     self.version)
         # Verify!
         # Must add newline at the end to match effect of print call
         self.assertEquals(self.fake_stdout.make_string(), output + '\n')
Exemplo n.º 3
0
 def _verify_unplug_iface(self, network_id, port_id):
         # Verification - get raw result from db
         port = db.port_get(port_id, network_id)
         # Fill CLI template
         output = cli.prepare_output("unplug_iface",
                                     self.tenant_id,
                                     dict(network_id=network_id,
                                          port_id=port['uuid']),
                                     self.version)
         # Verify!
         # Must add newline at the end to match effect of print call
         self.assertEquals(self.fake_stdout.make_string(), output + '\n')
Exemplo n.º 4
0
 def _verify_delete_network(self, network_id):
         # Verification - get raw result from db
         nw_list = db.network_list(self.tenant_id)
         if len(nw_list) != 0:
             self.fail("DB should not contain any network")
         # Fill CLI template
         output = cli.prepare_output('delete_net',
                                     self.tenant_id,
                                     dict(network_id=network_id),
                                     self.version)
         # Verify!
         # Must add newline at the end to match effect of print call
         self.assertEquals(self.fake_stdout.make_string(), output + '\n')
Exemplo n.º 5
0
 def _verify_create_network(self):
         # Verification - get raw result from db
         nw_list = db.network_list(self.tenant_id)
         if len(nw_list) != 1:
             self.fail("No network created")
         network_id = nw_list[0].uuid
         # Fill CLI template
         output = cli.prepare_output('create_net',
                                     self.tenant_id,
                                     dict(network_id=network_id),
                                     self.version)
         # Verify!
         # Must add newline at the end to match effect of print call
         self.assertEquals(self.fake_stdout.make_string(), output + '\n')
Exemplo n.º 6
0
 def _verify_list_ports_details(self, network_id):
         # Verification - get raw result from db
         port_list = db.port_list(network_id)
         ports = [dict(id=port.uuid, state=port.state)
                  for port in port_list]
         # Fill CLI template
         output = cli.prepare_output('list_ports_detail',
                                     self.tenant_id,
                                     dict(network_id=network_id,
                                          ports=ports),
                                     self.version)
         # Verify!
         # Must add newline at the end to match effect of print call
         self.assertEquals(self.fake_stdout.make_string(), output + '\n')
Exemplo n.º 7
0
 def _verify_show_network(self):
         # Verification - get raw result from db
         nw = db.network_list(self.tenant_id)[0]
         network = {'id': nw.uuid,
                    'name': nw.name,
                    'op-status': nw.op_status}
         # Fill CLI template
         output = cli.prepare_output('show_net',
                                     self.tenant_id,
                                     dict(network=network),
                                     self.version)
         # Verify!
         # Must add newline at the end to match effect of print call
         self.assertEquals(self.fake_stdout.make_string(), output + '\n')
Exemplo n.º 8
0
    def _verify_show_iface(self, network_id, port_id):
            # Verification - get raw result from db
            port = db.port_get(port_id, network_id)
            iface = {'id': port.interface_id or '<none>'}

            # Fill CLI template
            output = cli.prepare_output('show_iface',
                                        self.tenant_id,
                                        dict(network_id=network_id,
                                             port_id=port.uuid,
                                             iface=iface),
                                        self.version)
            # Verify!
            # Must add newline at the end to match effect of print call
            self.assertEquals(self.fake_stdout.make_string(), output + '\n')
Exemplo n.º 9
0
 def _verify_update_port(self, network_id, port_id):
         # Verification - get raw result from db
         port = db.port_get(port_id, network_id)
         port_data = {'id': port.uuid,
                      'state': port.state,
                      'op-status': port.op_status}
         # Fill CLI template
         output = cli.prepare_output('update_port',
                                     self.tenant_id,
                                     dict(network_id=network_id,
                                          port=port_data),
                                     self.version)
         # Verify!
         # Must add newline at the end to match effect of print call
         self.assertEquals(self.fake_stdout.make_string(), output + '\n')
Exemplo n.º 10
0
    def _verify_show_port_details(self, network_id, port_id):
            # Verification - get raw result from db
            # TODO(salvatore-orlando): Must resolve this issue with
            # attachment in separate bug fix.
            port = db.port_get(port_id, network_id)
            port_data = {'id': port.uuid,
                         'state': port.state,
                         'attachment': {'id': port.interface_id or '<none>'},
                         'op-status': port.op_status}

            # Fill CLI template
            output = cli.prepare_output('show_port_detail',
                                        self.tenant_id,
                                        dict(network_id=network_id,
                                             port=port_data),
                                        self.version)
            # Verify!
            # Must add newline at the end to match effect of print call
            self.assertEquals(self.fake_stdout.make_string(), output + '\n')