@@ -44,34 +44,39 @@ class ServerProfiles(object):
4444 DEFAULT_VALUES = {
4545 '200' : {"type" : "ServerProfileV5" },
4646 '300' : {"type" : "ServerProfileV6" },
47- '500' : {"type" : "ServerProfileV7" }
47+ '500' : {"type" : "ServerProfileV7" },
48+ '600' : {"type" : "ServerProfileV8" },
49+
4850 }
4951
5052 def __init__ (self , con ):
5153 self ._connection = con
5254 self ._client = ResourceClient (con , self .URI )
5355
54- def create (self , resource , timeout = - 1 ):
56+ def create (self , resource , timeout = - 1 , force = '' ):
5557 """
5658 Creates a server profile using the information provided in the resource parameter.
5759
5860 Args:
5961 resource (dict): Object to create.
6062 timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
6163 in OneView, just stop waiting for its completion.
64+ force: Comma separated list of flags for ignoring specific warning.
6265
6366 Returns:
6467 dict: Created server profile.
6568 """
66- return self ._client .create (resource = resource , timeout = timeout , default_values = self .DEFAULT_VALUES )
69+ uri = self .__build_uri_with_query_string ({"force" : force })
70+ return self ._client .create (resource = resource , uri = uri , timeout = timeout , default_values = self .DEFAULT_VALUES )
6771
68- def update (self , resource , id_or_uri ):
72+ def update (self , resource , id_or_uri , force = '' ):
6973 """
7074 Allows the configuration of a server profile object to be modified.
7175
7276 Args:
7377 id_or_uri: Can be either the server profile id or the server profile uri.
7478 resource (dict): Object to update.
79+ force: Comma separated list of flags for ignoring specific warning.
7580
7681 Returns:
7782 dict: The server profile resource.
@@ -80,7 +85,9 @@ def update(self, resource, id_or_uri):
8085 if resource .get ('serverHardwareUri' ) is None :
8186 resource .pop ('enclosureBay' , None )
8287 resource .pop ('enclosureUri' , None )
83- return self ._client .update (resource = resource , uri = id_or_uri , default_values = self .DEFAULT_VALUES )
88+
89+ uri = self . __build_uri_with_query_string ({'force' : force }, id_or_uri = id_or_uri )
90+ return self ._client .update (resource = resource , uri = uri , default_values = self .DEFAULT_VALUES )
8491
8592 def patch (self , id_or_uri , operation , path , value , timeout = - 1 ):
8693 """
@@ -305,24 +312,23 @@ def get_available_networks(self, **kwargs):
305312 server profile, along with their respective ports.
306313
307314 Args:
308- enclosureGroupUri (str):
309- The URI of the enclosure group associated with the resource.
310- functionType (str):
311- The FunctionType (Ethernet or FibreChannel) to filter the list of networks returned.
312- serverHardwareTypeUri (str):
313- The URI of the server hardware type associated with the resource.
314- serverHardwareUri (str):
315- The URI of the server hardware associated with the resource.
316- view (str):
317- Returns a specific subset of the attributes of the resource or collection, by specifying the name of a
318- predefined view. The default view is expand (show all attributes of the resource and all elements of
319- collections of resources).
315+ enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
316+ functionType (str): The FunctionType (Ethernet or FibreChannel) to filter the list of networks returned.
317+ serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
318+ serverHardwareUri (str): The URI of the server hardware associated with the resource.
319+ view (str): Returns a specific subset of the attributes of the resource or collection, by
320+ specifying the name of a predefined view. The default view is expand (show all attributes
321+ of the resource and all elements of collections of resources).
320322
321323 Values:
322324 Ethernet
323325 Specifies that the connection is to an Ethernet network or a network set.
324326 FibreChannel
325327 Specifies that the connection is to a Fibre Channel network.
328+ profileUri (str): If the URI of the server profile is provided the list of available networks will
329+ include only networks that share a scope with the server profile.
330+ scopeUris (str): An expression to restrict the resources returned according to the scopes
331+ to which they are assigned
326332
327333 Returns:
328334 list: Available networks.
@@ -335,12 +341,11 @@ def get_available_servers(self, **kwargs):
335341 Retrieves the list of available servers.
336342
337343 Args:
338- enclosureGroupUri (str):
339- The URI of the enclosure group associated with the resource.
340- serverHardwareTypeUri (str):
341- The URI of the server hardware type associated with the resource.
342- profileUri (str):
343- The URI of the server profile resource.
344+ enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
345+ serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
346+ profileUri (str): The URI of the server profile resource.
347+ scopeUris (str): An expression to restrict the resources returned according to
348+ the scopes to which they are assigned.
344349
345350 Returns:
346351 list: Available servers.
@@ -403,20 +408,19 @@ def get_available_targets(self, **kwargs):
403408 profile.
404409
405410 Args:
406- enclosureGroupUri (str):
407- The URI of the enclosure group associated with the resource.
408- serverHardwareTypeUri (str):
409- The URI of the server hardware type associated with the resource.
410- profileUri (str):
411- The URI of the server profile associated with the resource.
411+ enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
412+ serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
413+ profileUri (str): The URI of the server profile associated with the resource.
414+ scopeUris (str): An expression to restrict the resources returned according to
415+ the scopes to which they are assigned.
412416
413417 Returns:
414418 list: List of available servers and bays.
415419 """
416420 uri = self .__build_uri_with_query_string (kwargs , '/available-targets' )
417421 return self ._client .get (uri )
418422
419- def __build_uri_with_query_string (self , kwargs , sufix_path , id_or_uri = None ):
423+ def __build_uri_with_query_string (self , kwargs , sufix_path = '' , id_or_uri = None ):
420424 uri = self .URI
421425 if id_or_uri :
422426 uri = self ._client .build_uri (id_or_uri )
0 commit comments