config = { "ip": "<oneview_ip>", "credentials": { "userName": "******", "password": "******" } } # To run this example you must define a SAS Logical Interconnect id sas_logical_interconnect_id = "16b2990f-944a-449a-a78f-004d8b4e6824" # To install the firmware driver you must define the firmware_driver_uri firmware_driver_uri = "/rest/firmware-drivers/SPPgen9snap6_2016_0405_87" # Try load config from a file (if there is a config file) config = try_load_from_file(config) oneview_client = OneViewClient(config) # Get by ID if sas_logical_interconnect_id: print("\nGet a SAS Logical Interconnect by ID") sas_logical_interconnect = oneview_client.sas_logical_interconnects.get( sas_logical_interconnect_id) pprint(sas_logical_interconnect) # Get all SAS Logical Interconnects print("\nGet all SAS Logical Interconnects") logical_interconnects = oneview_client.sas_logical_interconnects.get_all() for sas_logical_interconnect in logical_interconnects: print(' Name: {name}'.format(**sas_logical_interconnect))
### from pprint import pprint from hpOneView.oneview_client import OneViewClient from config_loader import try_load_from_file config = { "ip": "<oneview_ip>", "credentials": { "userName": "******", "password": "******" } } # Try load config from a file (if there is a config file) config = try_load_from_file(config) oneview_client = OneViewClient(config) switch_types = oneview_client.switch_types # Get all supported switch types print("\nGet all supported switch types:") switch_types_all = switch_types.get_all() pprint(switch_types_all, depth=2) # Get all sorting by name descending print("\nGet all switch-types sorting by name:") switch_types_sorted = switch_types.get_all( sort='name:descending') pprint(switch_types_sorted, depth=2) if switch_types_all:
from pprint import pprint from config_loader import try_load_from_file from hpOneView.oneview_client import OneViewClient CONFIG = { "api_version": 600, "ip": "10", "credentials": { "userName": "******", "password": "******" } } #mac = sys.argv[1] config = try_load_from_file(CONFIG) oneview_client = OneViewClient(config) all_servers = oneview_client.server_hardware.get_all() #pprint(dict(all_servers[0].get_firmware())) def SPS(fwcomponent): return 'SPS' in fwcomponent['componentName'] for server in all_servers: fw = oneview_client.server_hardware.get_firmware(server['uri']) sps = filter(SPS, fw['components']) print('Server {} is running SPS firmware {}'.format(
### #!/usr/bin/env python import json from config_loader import try_load_from_file from hpOneView.exceptions import HPOneViewException from hpOneView.oneview_client import OneViewClient import sys config = {"ip": "", "credentials": {"userName": "", "password": ""}} profile_number = int(sys.argv[1]) scope_name = str(sys.argv[2]) profile_name_list = [] profile_uri_list = [] server_scopeUris = [] config = try_load_from_file(config, "oneview_config.json") # Once you get updated oneview_ansible library for api_version 600 comment the line below config['api_version'] = 600 oneview_client = OneViewClient(config) def get_scope_uri(scope_name): if scope_name: scope_response = oneview_client.scopes.get_by_name(scope_name) # print(scope_response) scope_uri = scope_response['uri'] return scope_uri def get_resource_scope_Uris(): # server_response = oneview_client.server_hardware.get_all()
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. ### #!/usr/bin/env python import json from config_loader import try_load_from_file from hpOneView.exceptions import HPOneViewException from hpOneView.oneview_client import OneViewClient from pprint import pprint import sys config = {"ip": "", "credentials": {"userName": "", "password": ""}} config_path = sys.argv[1] config = try_load_from_file(config, config_path) oneview_client = OneViewClient(config) image_streamer_client = oneview_client.create_image_streamer_client() validation_dict = {} validation_result = "True" resource_names_dict = {} resource_names_dict['scope'] = sys.argv[2] resource_names_dict['deployment_plan'] = sys.argv[3] resource_names_dict['deploy_network'] = sys.argv[4] resource_names_dict['mgmt_network'] = sys.argv[5] def validate_scope():