Exemplo n.º 1
0
    def _execute_connect_command_on_connected_resource(access_mode,
                                                       connected_resource,
                                                       reservation_id, session,
                                                       virtual_network,
                                                       vlan_service_name):

        _logger.debug('Executing Connect command on: ' + connected_resource)

        command_result = session.ExecuteCommand(
            reservation_id, connected_resource, 'Resource', 'Connect', [
                InputNameValue('VLAN_ID', virtual_network),
                InputNameValue('VLAN_SPEC_TYPE', access_mode)
            ], True)

        connect_results = get_result_from_command_output(command_result.Output)

        if not connect_results:
            _logger.debug('Connect command did not return any results')
            return

        for connect_result in connect_results:
            mac_address = connect_result['mac_address']
            _logger.debug('Setting Target Interface to: ' + mac_address)
            session.SetConnectorAttributes(
                reservation_id, connected_resource, vlan_service_name,
                [AttributeNameValue('Target Interface', mac_address)])
            break
 def execute_connect_command(access_mode,
                             generic_deployed_app_resource_model,
                             virtual_network):
     DeployedAppService.execute_command_on_vcenter_resource_and_passthrough_result(
         generic_deployed_app_resource_model, 'Connect VM', [
             InputNameValue('COMMAND', "connect"),
             InputNameValue('VLAN_ID', virtual_network),
             InputNameValue('VLAN_SPEC_TYPE', access_mode),
             InputNameValue('VM_UUID',
                            generic_deployed_app_resource_model.vm_uuid)
         ])
 def refresh_ip(self):
     """ Executes 'Refresh IP' on the vCenter for the deployed app its executed on """
     DeployedAppService.execute_command_on_vcenter_resource(
         self.generic_deployed_app_resource_model, "Refresh IP", [
             InputNameValue('COMMAND', 'refresh_ip'),
             InputNameValue('RESOURCE_FULLNAME',
                            self.resource_context.fullname),
             InputNameValue(
                 'VM_UUID',
                 self.generic_deployed_app_resource_model.vm_uuid)
         ])
from qualipy.api.cloudshell_api import InputNameValue
import json
from os import environ as parameter
import thread

# Get CloudShell information passed as env. variables
connectivity = json.loads(parameter["QUALICONNECTIVITYCONTEXT"])
reservationDetails = json.loads(parameter["RESERVATIONCONTEXT"])
resourceDetails = json.loads(parameter["RESOURCECONTEXT"])
command_name = parameter["command_name"]
command_inputs = parameter["command_inputs"].split(',')
processed_command_inputs = []
if command_inputs == ['']: command_inputs = []
for index in range(0, len(command_inputs), 2):
    processed_command_inputs.append(
        InputNameValue(command_inputs[index], command_inputs[index + 1]))
command_tag = parameter["command_tag"]
print_output = parameter["print_output"] == "True"
use_exact_name = parameter["use_exact_name"] == "True"
run_synchronously = parameter["run_synchronously"] == "True"

# Create an API Session on TestShell Python API
api = CloudShellAPISession(connectivity["serverAddress"],
                           connectivity["adminUser"],
                           connectivity["adminPass"],
                           reservationDetails["domain"])
reservation_details_from_api = api.GetReservationDetails(
    reservationDetails["id"])

for resource in reservation_details_from_api.ReservationDescription.Resources:
    try:
Exemplo n.º 5
0
from qualipy.api.cloudshell_api import CloudShellAPISession
from qualipy.api.cloudshell_api import InputNameValue
import json
from os import environ as parameter
import sys

# Get CloudShell information passed as env. variables
connectivity = json.loads(parameter["QUALICONNECTIVITYCONTEXT"])
reservationDetails = json.loads(parameter["RESERVATIONCONTEXT"])
resourceDetails = json.loads(parameter["RESOURCECONTEXT"])
command_name = parameter["command_name"]
command_inputs = parameter["command_inputs"].split(',')
processed_command_inputs = []
if command_inputs == ['']: command_inputs = []
for index in range(0,len(command_inputs),2):
    processed_command_inputs.append(InputNameValue(command_inputs[index],command_inputs[index+1]))
print_output = parameter["print_output"]=="True"
use_exact_name = parameter["use_exact_name"] == "True"
run_synchronously = parameter["run_synchronously"] == "True"

# Create an API Session on TestShell Python API
api = CloudShellAPISession(connectivity["serverAddress"], connectivity["adminUser"], connectivity["adminPass"], reservationDetails["domain"])
reservation_details_from_api = api.GetReservationDetails(reservationDetails["id"])
entities_run = []

if run_synchronously:
    MethodToRun = api.ExecuteCommand
else:
    MethodToRun = api.EnqueueCommand

for resource in reservation_details_from_api.ReservationDescription.Resources: