def test_vm_host_save_update_with_new_vSwitch(self):
        host_id = 'VH1'
        vmhost = VmHost()
        vmhost.id = host_id

        vSwitch = VirtualSwitch()
        vSwitch.set_id('vSwitch-01')
        vSwitch.set_name('vSwitch-01')
        vSwitch.set_resourceManagerId('rmId')
        vSwitch.set_switchType('vSwitch')

        cost1 = Cost()
        cost1.set_value(100)
        cost1.set_units('USD')
        vSwitch.set_cost(cost1)

        portGroup = PortGroup()
        portGroup.set_id('pg-01')
        portGroup.set_name('pg-01')
        portGroup.set_resourceManagerId('rmId')
        portGroup.set_type('portgroup_type')
        portGroup.set_cost(cost1)
        vSwitch.add_portGroups(portGroup)
        vmhost.add_virtualSwitches(vSwitch)
        vmhost.add_portGroups(portGroup)
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost)

        vSwitch_new = VirtualSwitch()
        vSwitch_new.set_id('vSwitch-02')
        vSwitch_new.set_name('vSwitch-02')
        vSwitch_new.set_resourceManagerId('rmId')
        vSwitch_new.set_switchType('vSwitch')

        portGroup_new = PortGroup()
        portGroup_new.set_id('pg-02')
        portGroup_new.set_name('pg-02')
        portGroup_new.set_resourceManagerId('rmId')
        portGroup_new.set_type('portgroup_type')
        vSwitch.add_portGroups(portGroup_new)
        vmhost.add_virtualSwitches(vSwitch_new)
        vmhost.add_portGroups(portGroup_new)
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost)

        vmhosts = \
            healthnmon_db_api.vm_host_get_by_ids(get_admin_context(),
                                                 [host_id])
        self.assertFalse(vmhosts is None,
                         'Host get by id returned a none list')
        self.assertTrue(len(vmhosts) > 0,
                        'Host get by id returned invalid number of list'
                        )
        self.assertTrue(
            len(vmhosts[0].get_virtualSwitches()) > 0,
            'Host get by virtual switch returned invalid number of list')
        self.assertTrue(
            len(vmhosts[0].get_portGroups()) > 0,
            'Host get by port group returned invalid number of list')
        self.assertTrue(vmhosts[0].id == host_id)
    def test_port_group_save(self):
        portgroup = PortGroup()
        portgroup.id = 'PG1'
        portgroup.name = 'test'
        portgroup.note = 'note'
        api.port_group_save(get_admin_context(), portgroup)

        portgroup = PortGroup()
        portgroup.id = 'PG1'
        portgroup.name = 'test'
        portgroup.note = 'note'
        cost = Cost()
        cost.value = Decimal('123.00')
        cost.units = 'INR'
        portgroup.cost = cost
        portgroup.resourceManagerId = 'rm1'
        portgroup.type = 'port'
        portgroup.virtualSwitchId = 'VS1'
        portgroup.vmHostId = 'VM1'
        api.port_group_save(get_admin_context(), portgroup)
        pgs = api.port_group_get_by_ids(get_admin_context(),
                                        [portgroup.id])

        indexOfThePG = -1
        for pg in pgs:
            if pg.id == portgroup.id:
                indexOfThePG = pgs.index(pg)
                break

        self.assertTrue(
            portgroup.id == pgs[indexOfThePG].id, 'Portgroup id is invalid')
        self.assertTrue(portgroup.name == pgs[indexOfThePG].name,
                        ' PortGroup name is invalid')
        self.assertTrue(portgroup.note == pgs[indexOfThePG].note,
                        'PortGroup Note is invalid')
        self.assertTrue(portgroup.cost.value == pgs[indexOfThePG]
                        .cost.value, 'PortGroup Value is invalid')
        self.assertTrue(portgroup.cost.units == pgs[indexOfThePG]
                        .cost.units, 'PortGroup Units is invalid')
        self.assertTrue(
            portgroup.resourceManagerId == pgs[indexOfThePG].resourceManagerId,
            'PortGroup resourceManagerId is invalid')
        self.assertTrue(portgroup.get_type(
        ) == pgs[indexOfThePG].get_type(), 'PortGroup type is invalid')
        self.assertTrue(
            portgroup.virtualSwitchId == pgs[indexOfThePG].virtualSwitchId,
            'PortGroup virtualSwitchId is invalid')
        self.assertTrue(portgroup.vmHostId == pgs[indexOfThePG]
                        .vmHostId, 'PortGroup vmHostId is invalid')

        self.assertTrue(len(pgs) == 1,
                        'port groups all returned valid number of list')
Beispiel #3
0
    def test_vm_host_save_update_with_new_vSwitch(self):
        host_id = 'VH1'
        vmhost = VmHost()
        vmhost.id = host_id

        vSwitch = VirtualSwitch()
        vSwitch.set_id('vSwitch-01')
        vSwitch.set_name('vSwitch-01')
        vSwitch.set_resourceManagerId('rmId')
        vSwitch.set_switchType('vSwitch')

        cost1 = Cost()
        cost1.set_value(100)
        cost1.set_units('USD')
        vSwitch.set_cost(cost1)

        portGroup = PortGroup()
        portGroup.set_id('pg-01')
        portGroup.set_name('pg-01')
        portGroup.set_resourceManagerId('rmId')
        portGroup.set_type('portgroup_type')
        portGroup.set_cost(cost1)
        vSwitch.add_portGroups(portGroup)
        vmhost.add_virtualSwitches(vSwitch)
        vmhost.add_portGroups(portGroup)
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost)

        vSwitch_new = VirtualSwitch()
        vSwitch_new.set_id('vSwitch-02')
        vSwitch_new.set_name('vSwitch-02')
        vSwitch_new.set_resourceManagerId('rmId')
        vSwitch_new.set_switchType('vSwitch')

        portGroup_new = PortGroup()
        portGroup_new.set_id('pg-02')
        portGroup_new.set_name('pg-02')
        portGroup_new.set_resourceManagerId('rmId')
        portGroup_new.set_type('portgroup_type')
        vSwitch.add_portGroups(portGroup_new)
        vmhost.add_virtualSwitches(vSwitch_new)
        vmhost.add_portGroups(portGroup_new)
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost)

        vmhosts = \
            healthnmon_db_api.vm_host_get_by_ids(get_admin_context(),
                                                 [host_id])
        self.assertFalse(vmhosts is None,
                         'Host get by id returned a none list')
        self.assertTrue(
            len(vmhosts) > 0, 'Host get by id returned invalid number of list')
        self.assertTrue(
            len(vmhosts[0].get_virtualSwitches()) > 0,
            'Host get by virtual switch returned invalid number of list')
        self.assertTrue(
            len(vmhosts[0].get_portGroups()) > 0,
            'Host get by port group returned invalid number of list')
        self.assertTrue(vmhosts[0].id == host_id)
 def _create_cost(self):
     cost1 = Cost()
     cost1.set_value(100)
     cost1.set_units('USD')
     return cost1
    def test_vm_host_delete(self):
        vmhost_id = 'VH1'
        vmhost = VmHost()
        vmhost.id = vmhost_id
        vSwitch = VirtualSwitch()
        vSwitch.set_id('vSwitch-01')
        vSwitch.set_name('vSwitch-01')
        vSwitch.set_resourceManagerId('rmId')
        vSwitch.set_switchType('vSwitch')

        cost1 = Cost()
        cost1.set_value(100)
        cost1.set_units('USD')
        vSwitch.set_cost(cost1)

        portGroup = PortGroup()
        portGroup.set_id('pg-01')
        portGroup.set_name('pg-01')
        portGroup.set_resourceManagerId('rmId')
        portGroup.set_type('portgroup_type')
        portGroup.set_cost(cost1)
        vSwitch.add_portGroups(portGroup)
        vmhost.add_virtualSwitches(vSwitch)
        vmhost.add_portGroups(portGroup)
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost)

        vmhost2 = VmHost()
        vmhost2.set_id('VH2')
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost2)

        storage = StorageVolume()
        storage.set_id('sv-01')
        storage.set_name('storage-01')
        storage.set_resourceManagerId('rmId')
        storage.set_size(1234)
        storage.set_free(2345)
        storage.set_vmfsVolume(True)
        storage.set_shared(True)
        storage.set_assignedServerCount(1)
        storage.set_volumeType('VMFS')
        storage.set_volumeId('101')

        hostMount1 = HostMountPoint()
        hostMount1.set_path('test_path1')
        hostMount1.set_vmHostId('VH1')
        storage.add_mountPoints(hostMount1)
        hostMount2 = HostMountPoint()
        hostMount2.set_path('test_path2')
        hostMount2.set_vmHostId('VH2')
        storage.add_mountPoints(hostMount2)
        healthnmon_db_api.storage_volume_save(get_admin_context(),
                                              storage)

        vm = Vm()
        vm.set_id('vm-01')
        vm.set_name('vm-01')
        vm.set_vmHostId('VH1')
        healthnmon_db_api.vm_save(get_admin_context(), vm)

        vmhosts = \
            healthnmon_db_api.vm_host_get_by_ids(get_admin_context(),
                                                 [vmhost_id])
        self.assertFalse(vmhosts is None,
                         'host get by id returned a none list')
        self.assertTrue(len(vmhosts) > 0,
                        'host get by id returned invalid number of list'
                        )

        healthnmon_db_api.vm_host_delete_by_ids(get_admin_context(),
                                                [vmhost_id])

        vmhosts = \
            healthnmon_db_api.vm_host_get_by_ids(get_admin_context(),
                                                 [vmhost_id])
        self.assertTrue(vmhosts is None or len(vmhosts) == 0,
                        'host not deleted')
Beispiel #6
0
 def _create_cost(self):
     cost1 = Cost()
     cost1.set_value(100)
     cost1.set_units('USD')
     return cost1
Beispiel #7
0
    def test_vm_host_delete(self):
        vmhost_id = 'VH1'
        vmhost = VmHost()
        vmhost.id = vmhost_id
        vSwitch = VirtualSwitch()
        vSwitch.set_id('vSwitch-01')
        vSwitch.set_name('vSwitch-01')
        vSwitch.set_resourceManagerId('rmId')
        vSwitch.set_switchType('vSwitch')

        cost1 = Cost()
        cost1.set_value(100)
        cost1.set_units('USD')
        vSwitch.set_cost(cost1)

        portGroup = PortGroup()
        portGroup.set_id('pg-01')
        portGroup.set_name('pg-01')
        portGroup.set_resourceManagerId('rmId')
        portGroup.set_type('portgroup_type')
        portGroup.set_cost(cost1)
        vSwitch.add_portGroups(portGroup)
        vmhost.add_virtualSwitches(vSwitch)
        vmhost.add_portGroups(portGroup)
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost)

        vmhost2 = VmHost()
        vmhost2.set_id('VH2')
        healthnmon_db_api.vm_host_save(get_admin_context(), vmhost2)

        storage = StorageVolume()
        storage.set_id('sv-01')
        storage.set_name('storage-01')
        storage.set_resourceManagerId('rmId')
        storage.set_size(1234)
        storage.set_free(2345)
        storage.set_vmfsVolume(True)
        storage.set_shared(True)
        storage.set_assignedServerCount(1)
        storage.set_volumeType('VMFS')
        storage.set_volumeId('101')

        hostMount1 = HostMountPoint()
        hostMount1.set_path('test_path1')
        hostMount1.set_vmHostId('VH1')
        storage.add_mountPoints(hostMount1)
        hostMount2 = HostMountPoint()
        hostMount2.set_path('test_path2')
        hostMount2.set_vmHostId('VH2')
        storage.add_mountPoints(hostMount2)
        healthnmon_db_api.storage_volume_save(get_admin_context(), storage)

        vm = Vm()
        vm.set_id('vm-01')
        vm.set_name('vm-01')
        vm.set_vmHostId('VH1')
        healthnmon_db_api.vm_save(get_admin_context(), vm)

        vmhosts = \
            healthnmon_db_api.vm_host_get_by_ids(get_admin_context(),
                                                 [vmhost_id])
        self.assertFalse(vmhosts is None,
                         'host get by id returned a none list')
        self.assertTrue(
            len(vmhosts) > 0, 'host get by id returned invalid number of list')

        #        self.assertRaises(Exception, healthnmon_db_api.vm_host_delete_by_ids,([vmhost_id]))

        healthnmon_db_api.vm_host_delete_by_ids(get_admin_context(),
                                                [vmhost_id])

        vmhosts = \
            healthnmon_db_api.vm_host_get_by_ids(get_admin_context(),
                                                 [vmhost_id])
        self.assertTrue(vmhosts is None or len(vmhosts) == 0,
                        'host not deleted')
 def test_virtual_switch_save_with_subnet(self):
     # Save virtual switch with a port group
     vSwitch = VirtualSwitch()
     vSwitch.set_id("vSwitch-11")
     vSwitch.set_name("vSwitch-11")
     vSwitch.set_resourceManagerId("rmId")
     vSwitch.set_switchType("vSwitch")
     cost1 = Cost()
     cost1.set_value(100)
     cost1.set_units("USD")
     vSwitch.set_cost(cost1)
     portGroup = PortGroup()
     portGroup.set_id("pg-01")
     portGroup.set_name("pg-01")
     portGroup.set_resourceManagerId("rmId")
     portGroup.set_type("portgroup_type")
     portGroup.set_cost(cost1)
     vSwitch.add_portGroups(portGroup)
     api.virtual_switch_save(self.admin_context, vSwitch)
     # Update after adding a port group and subnet
     vSwitch = api.virtual_switch_get_by_ids(self.admin_context, [vSwitch.id])[0]
     portGroup2 = PortGroup()
     portGroup2.set_id("pg-02")
     portGroup2.set_name("pg-02")
     portGroup2.set_resourceManagerId("rmId")
     portGroup2.set_type("portgroup_type")
     vSwitch.add_portGroups(portGroup2)
     subnet = Subnet()
     subnet.set_id("subnet-02")
     subnet.set_name("subnet-02")
     subnet.set_networkAddress("1.1.1.1")
     api.subnet_save(self.admin_context, subnet)
     vSwitch.add_subnetIds(subnet.id)
     vSwitch.add_networkInterfaces("1")
     api.virtual_switch_save(self.admin_context, vSwitch)
     virtualswitches = api.virtual_switch_get_by_ids(self.admin_context, [vSwitch.id])
     # Assert the values
     self.assertTrue(len(virtualswitches) == 1, "Unexpected number of Virtual Switch returned")
     self.assertTrue(virtualswitches[0].get_id() == "vSwitch-11", "Virtual Switch id mismatch")
     self.assertTrue(virtualswitches[0].get_name() == "vSwitch-11", "Virtual Switch name mismatch")
     self.assertTrue(
         virtualswitches[0].get_resourceManagerId() == "rmId", "Virtual Switch Resource Manager id mismatch"
     )
     self.assertTrue(virtualswitches[0].get_switchType() == "vSwitch", "Virtual Switch type mismatch")
     cost1 = virtualswitches[0].get_cost()
     self.assertTrue(cost1.get_value() == 100, "VSwitch Cost Value mismatch")
     self.assertTrue(cost1.get_units() == "USD", "VSwitch Cost units mismatch")
     portGroups = virtualswitches[0].get_portGroups()
     self.assertTrue(len(portGroups) == 2, "All the portgroups have not been saved")
     self.assertTrue(portGroups[0].get_id() == "pg-01", "VSwitch Port Group id mismatch")
     self.assertTrue(portGroups[0].get_name() == "pg-01", "VSwitch Port Group Name mismatch")
     self.assertTrue(
         portGroups[0].get_resourceManagerId() == "rmId", "VSwitch portgroup Resource Manager id mismatch"
     )
     self.assertTrue(portGroups[0].get_type() == "portgroup_type", "VSwitch port group type mismatched")
     cost2 = portGroups[0].get_cost()
     self.assertTrue(cost2.get_value() == 100, "PortGroup Cost Value mismatch")
     self.assertTrue(cost2.get_units() == "USD", "PortGroup Cost units mismatch")
     self.assertTrue(portGroups[1].get_id() == "pg-02", "VSwitch Port Group id mismatch")
     self.assertTrue(portGroups[1].get_name() == "pg-02", "VSwitch Port Group Name mismatch")
     self.assertTrue(
         portGroups[1].get_resourceManagerId() == "rmId", "VSwitch portgroup Resource Manager id mismatch"
     )
     self.assertTrue(portGroups[1].get_type() == "portgroup_type", "VSwitch port group type mismatched")
     subnetId = virtualswitches[0].get_subnetIds()
     self.assertTrue(subnetId[0] == "subnet-02", "Virtual Switch subnet id mismatch")
     self.assertTrue(
         virtualswitches[0].get_networkInterfaces()[0] == "1", "Virtual Switch network INterfaces mismatch"
     )
 def test_virtual_switch_save_with_subnet(self):
     # Save virtual switch with a port group
     vSwitch = VirtualSwitch()
     vSwitch.set_id('vSwitch-11')
     vSwitch.set_name('vSwitch-11')
     vSwitch.set_resourceManagerId('rmId')
     vSwitch.set_switchType('vSwitch')
     cost1 = Cost()
     cost1.set_value(100)
     cost1.set_units('USD')
     vSwitch.set_cost(cost1)
     portGroup = PortGroup()
     portGroup.set_id('pg-01')
     portGroup.set_name('pg-01')
     portGroup.set_resourceManagerId('rmId')
     portGroup.set_type('portgroup_type')
     portGroup.set_cost(cost1)
     vSwitch.add_portGroups(portGroup)
     api.virtual_switch_save(self.admin_context, vSwitch)
     # Update after adding a port group and subnet
     vSwitch = api.virtual_switch_get_by_ids(self.admin_context,
                                             [vSwitch.id])[0]
     portGroup2 = PortGroup()
     portGroup2.set_id('pg-02')
     portGroup2.set_name('pg-02')
     portGroup2.set_resourceManagerId('rmId')
     portGroup2.set_type('portgroup_type')
     vSwitch.add_portGroups(portGroup2)
     subnet = Subnet()
     subnet.set_id('subnet-02')
     subnet.set_name('subnet-02')
     subnet.set_networkAddress('1.1.1.1')
     api.subnet_save(self.admin_context, subnet)
     vSwitch.add_subnetIds(subnet.id)
     vSwitch.add_networkInterfaces('1')
     api.virtual_switch_save(self.admin_context, vSwitch)
     virtualswitches = \
         api.virtual_switch_get_by_ids(self.admin_context,
                                       [vSwitch.id])
     # Assert the values
     self.assertTrue(len(virtualswitches) == 1,
                     'Unexpected number of Virtual Switch returned')
     self.assertTrue(virtualswitches[0].get_id(
     ) == 'vSwitch-11', 'Virtual Switch id mismatch')
     self.assertTrue(virtualswitches[0].get_name(
     ) == 'vSwitch-11', 'Virtual Switch name mismatch')
     self.assertTrue(virtualswitches[0].get_resourceManagerId(
     ) == 'rmId', 'Virtual Switch Resource Manager id mismatch')
     self.assertTrue(virtualswitches[0].get_switchType(
     ) == 'vSwitch', 'Virtual Switch type mismatch')
     cost1 = virtualswitches[0].get_cost()
     self.assertTrue(
         cost1.get_value() == 100, 'VSwitch Cost Value mismatch')
     self.assertTrue(
         cost1.get_units() == 'USD', 'VSwitch Cost units mismatch')
     portGroups = virtualswitches[0].get_portGroups()
     self.assertTrue(
         len(portGroups) == 2, 'All the portgroups have not been saved')
     self.assertTrue(portGroups[0].get_id(
     ) == 'pg-01', 'VSwitch Port Group id mismatch')
     self.assertTrue(portGroups[0].get_name(
     ) == 'pg-01', 'VSwitch Port Group Name mismatch')
     self.assertTrue(portGroups[0].get_resourceManagerId(
     ) == 'rmId', 'VSwitch portgroup Resource Manager id mismatch')
     self.assertTrue(portGroups[0].get_type(
     ) == 'portgroup_type', 'VSwitch port group type mismatched')
     cost2 = portGroups[0].get_cost()
     self.assertTrue(
         cost2.get_value() == 100, 'PortGroup Cost Value mismatch')
     self.assertTrue(
         cost2.get_units() == 'USD', 'PortGroup Cost units mismatch')
     self.assertTrue(portGroups[1].get_id(
     ) == 'pg-02', 'VSwitch Port Group id mismatch')
     self.assertTrue(portGroups[1].get_name(
     ) == 'pg-02', 'VSwitch Port Group Name mismatch')
     self.assertTrue(portGroups[1].get_resourceManagerId(
     ) == 'rmId', 'VSwitch portgroup Resource Manager id mismatch')
     self.assertTrue(portGroups[1].get_type(
     ) == 'portgroup_type', 'VSwitch port group type mismatched')
     subnetId = virtualswitches[0].get_subnetIds()
     self.assertTrue(
         subnetId[0] == 'subnet-02', 'Virtual Switch subnet id mismatch')
     self.assertTrue(virtualswitches[0].get_networkInterfaces(
     )[0] == '1', 'Virtual Switch network INterfaces mismatch')
Beispiel #10
0
 def test_virtual_switch_save_with_subnet(self):
     # Save virtual switch with a port group
     vSwitch = VirtualSwitch()
     vSwitch.set_id('vSwitch-11')
     vSwitch.set_name('vSwitch-11')
     vSwitch.set_resourceManagerId('rmId')
     vSwitch.set_switchType('vSwitch')
     cost1 = Cost()
     cost1.set_value(100)
     cost1.set_units('USD')
     vSwitch.set_cost(cost1)
     portGroup = PortGroup()
     portGroup.set_id('pg-01')
     portGroup.set_name('pg-01')
     portGroup.set_resourceManagerId('rmId')
     portGroup.set_type('portgroup_type')
     portGroup.set_cost(cost1)
     vSwitch.add_portGroups(portGroup)
     api.virtual_switch_save(self.admin_context, vSwitch)
     # Update after adding a port group and subnet
     vSwitch = api.virtual_switch_get_by_ids(self.admin_context,
                                             [vSwitch.id])[0]
     portGroup2 = PortGroup()
     portGroup2.set_id('pg-02')
     portGroup2.set_name('pg-02')
     portGroup2.set_resourceManagerId('rmId')
     portGroup2.set_type('portgroup_type')
     vSwitch.add_portGroups(portGroup2)
     subnet = Subnet()
     subnet.set_id('subnet-02')
     subnet.set_name('subnet-02')
     subnet.set_networkAddress('1.1.1.1')
     api.subnet_save(self.admin_context, subnet)
     vSwitch.add_subnetIds(subnet.id)
     vSwitch.add_networkInterfaces('1')
     api.virtual_switch_save(self.admin_context, vSwitch)
     virtualswitches = \
         api.virtual_switch_get_by_ids(self.admin_context,
                                       [vSwitch.id])
     # Assert the values
     self.assertTrue(
         len(virtualswitches) == 1,
         'Unexpected number of Virtual Switch returned')
     self.assertTrue(virtualswitches[0].get_id() == 'vSwitch-11',
                     'Virtual Switch id mismatch')
     self.assertTrue(virtualswitches[0].get_name() == 'vSwitch-11',
                     'Virtual Switch name mismatch')
     self.assertTrue(virtualswitches[0].get_resourceManagerId() == 'rmId',
                     'Virtual Switch Resource Manager id mismatch')
     self.assertTrue(virtualswitches[0].get_switchType() == 'vSwitch',
                     'Virtual Switch type mismatch')
     cost1 = virtualswitches[0].get_cost()
     self.assertTrue(cost1.get_value() == 100,
                     'VSwitch Cost Value mismatch')
     self.assertTrue(cost1.get_units() == 'USD',
                     'VSwitch Cost units mismatch')
     portGroups = virtualswitches[0].get_portGroups()
     self.assertTrue(
         len(portGroups) == 2, 'All the portgroups have not been saved')
     self.assertTrue(portGroups[0].get_id() == 'pg-01',
                     'VSwitch Port Group id mismatch')
     self.assertTrue(portGroups[0].get_name() == 'pg-01',
                     'VSwitch Port Group Name mismatch')
     self.assertTrue(portGroups[0].get_resourceManagerId() == 'rmId',
                     'VSwitch portgroup Resource Manager id mismatch')
     self.assertTrue(portGroups[0].get_type() == 'portgroup_type',
                     'VSwitch port group type mismatched')
     cost2 = portGroups[0].get_cost()
     self.assertTrue(cost2.get_value() == 100,
                     'PortGroup Cost Value mismatch')
     self.assertTrue(cost2.get_units() == 'USD',
                     'PortGroup Cost units mismatch')
     self.assertTrue(portGroups[1].get_id() == 'pg-02',
                     'VSwitch Port Group id mismatch')
     self.assertTrue(portGroups[1].get_name() == 'pg-02',
                     'VSwitch Port Group Name mismatch')
     self.assertTrue(portGroups[1].get_resourceManagerId() == 'rmId',
                     'VSwitch portgroup Resource Manager id mismatch')
     self.assertTrue(portGroups[1].get_type() == 'portgroup_type',
                     'VSwitch port group type mismatched')
     subnetId = virtualswitches[0].get_subnetIds()
     self.assertTrue(subnetId[0] == 'subnet-02',
                     'Virtual Switch subnet id mismatch')
     self.assertTrue(virtualswitches[0].get_networkInterfaces()[0] == '1',
                     'Virtual Switch network INterfaces mismatch')