def setUp(self):
     self.host = '127.0.0.1'
     self.connection = connection(self.host)
     self._network_sets = NetworkSets(self.connection)
     self._network_sets.data = {
         'uri': '/rest/network-sets/ad28cf21-8b15-4f92-bdcf-51cb2042db32'
     }
    def test_get_sp_vlan_network_interface_collection(self):
        with open('oneview_redfish_toolkit/mockups/'
                  'redfish/VLanNetworkInterfaceCollectionSP.json') as f:
            expected_vlan_network_interface_collection = json.load(f)

        profile_obj = ServerProfiles(self.oneview_client, self.server_profile)
        self.oneview_client.server_profiles.get_by_id.return_value = \
            profile_obj

        network_set_obj = NetworkSets(self.oneview_client,
                                      self.network_set_mockup)
        self.oneview_client.network_sets.get_by_uri.return_value = \
            network_set_obj

        response = self.client.get("/redfish/v1/Systems"
                                   "/1f0ca9ef-7f81-45e3-9d64-341b46cf87e0/"
                                   "EthernetInterfaces/1/VLANs")

        result = json.loads(response.data.decode("utf-8"))

        self.assertEqual(status.HTTP_200_OK, response.status_code)
        self.assertEqual("application/json", response.mimetype)
        self.assertEqualMockup(expected_vlan_network_interface_collection,
                               result)
        self.oneview_client.server_profiles.get_by_id.assert_called_with(
            self.server_profile["uri"].split("/")[-1])
        self.oneview_client.network_sets.get_by_uri.assert_called_with(
            self.network_set_mockup["uri"])
    def network_sets(self):
        """
        Gets the NetworkSets API client.

        Returns:
            NetworkSets:
        """
        return NetworkSets(self.__connection)
    def network_sets(self):
        """
        Gets the NetworkSets API client.

        Returns:
            NetworkSets:
        """
        if not self.__network_sets:
            self.__network_sets = NetworkSets(self.__connection)
        return self.__network_sets
Beispiel #5
0
 def setUp(self):
     self.host = '127.0.0.1'
     self.connection = connection(self.host)
     self._network_sets = NetworkSets(self.connection)
 def network_sets(self):
     if not self.__network_sets:
         self.__network_sets = NetworkSets(self.__connection)
     return self.__network_sets