Exemplo n.º 1
0
def create_context():
    context = ResourceCommandContext()
    context.resource = ResourceContextDetails()
    context.resource.name = 'Huawei37'
    context.reservation = ReservationContextDetails()
    context.reservation.reservation_id = '5695cf87-a4f3-4447-a08a-1a99a936010e'
    context.reservation.owner_user = '******'
    context.reservation.owner_email = '*****@*****.**'
    context.reservation.environment_path = 'Environment-6-7-2016 15-25'
    context.reservation.environment_name = 'Environment-6-7-2016 15-25'
    context.reservation.domain = 'Global'
    context.resource.attributes = {}
    context.resource.attributes['CLI Connection Type'] = 'SSH'
    context.resource.attributes['User'] = '******'
    context.resource.attributes['AdminUser'] = '******'
    context.resource.attributes[
        'Console Password'] = '******'
    context.resource.attributes['Password'] = '******'
    context.resource.attributes[
        'Enable Password'] = '******'
    context.resource.address = '172.19.47.74'
    context.resource.attributes['SNMP Version'] = '2'
    context.resource.attributes['SNMP Read Community'] = 'Test1234'
    context.resource.attributes['Model'] = 'Enterprises.2011.2.23.339'
    context.resource.attributes['AdminPassword'] = '******'
    context.resource.attributes['Vendor'] = 'huawei'
    context.resource.attributes['Enable SNMP'] = 'True'
    context.resource.attributes['Disable SNMP'] = 'False'
    context.resource.attributes['CLI TCP Port'] = '0'
    context.resource.attributes['Sessions Concurrency Limit'] = 2
    context.resource.name = '2950'
    return context
Exemplo n.º 2
0
def create_context():
    context = ResourceCommandContext()
    context.resource = ResourceContextDetails()
    context.resource.name = 'Switch for Demo'
    context.resource.address = '<IP>'
    context.resource.attributes = {}
    context.resource.attributes['CLI Connection Type'] = 'SSH'
    context.resource.attributes['User'] = '******'
    context.resource.attributes['AdminUser'] = '******'
    context.resource.attributes['Console Password'] = '******'
    context.resource.attributes['Password'] = '******'
    context.resource.attributes['Enable Password'] = '******'
    context.resource.attributes['Sessions Concurrency Limit'] = 2

    return context
Exemplo n.º 3
0
    def setUp(self):
        self.context = ResourceCommandContext()
        self.context.resource = ResourceContextDetails()
        self.context.resource.name = 'resource'
        self.context.reservation = Mock()
        self.context.reservation.reservation_id = 'e34aa58a-468e-49a1-8a1d-0da1d2cc5b41'

        self.file_system = Mock()
        self.file_system.create_file = Mock(
            return_value=mock_enter_exit(Mock()))
        self.downloader = Mock()
        self.executor = Mock()
        self.executor.execute_playbook = Mock(return_value=['', ''])
        self.logger = mock_enter_exit(Mock())
        session = Mock()
        session_context = Mock()
        session_context.__enter__ = Mock(return_value=session)
        session_context.__exit__ = Mock()
        self.session_provider = Mock()
        self.session_provider.get = Mock(return_value=session_context)

        self.conf = AnsibleConfiguration()
        self.conf.timeout_minutes = "0.0"
        self.shell = AnsibleShell(self.file_system, self.downloader,
                                  self.executor)
        self.shell.connection_service.check_connection = Mock()

        self.ansible_result_patcher = patch(
            'cloudshell.cm.ansible.ansible_shell.AnsibleResult')
        self.ansible_result = Mock()
        self.ansible_result.success = True
        self.ansible_result.ctor = self.ansible_result_patcher.start()
        self.ansible_result.ctor.return_value = self.ansible_result
Exemplo n.º 4
0
def create_context():
    context = ResourceCommandContext()
    context.resource = ResourceContextDetails()
    context.resource.name = 'TestCenter Controller 1'
    context.reservation = ReservationContextDetails()
    context.reservation.reservation_id = 'bc3aa7d1-7d66-4365-b419-65b90ece4d0f'
    context.reservation.owner_user = '******'
    context.reservation.owner_email = '*****@*****.**'
    context.reservation.environment_path = 'config1'
    context.reservation.environment_name = 'config1'
    context.reservation.domain = 'Global'
    context.resource.attributes = {}
    context.resource.attributes[
        'Client Install Path'] = 'C:\Program Files (x86)\Spirent Communications\Spirent TestCenter 4.52'
    context.resource.address = 'localhost'
    return context
def create_context():
    context = ResourceCommandContext()
    context.resource = ResourceContextDetails()
    context.resource.name = 'Brocy'
    context.reservation = ReservationContextDetails()
    context.reservation.reservation_id = '5695cf87-a4f3-4447-a08a-1a99a936010e'
    context.reservation.owner_user = '******'
    context.reservation.owner_email = '*****@*****.**'
    context.reservation.environment_path ='Environment-6-7-2016 15-25'
    context.reservation.environment_name = 'Environment-6-7-2016 15-25'
    context.reservation.domain = 'Global'
    context.resource.attributes = {}
    context.resource.attributes['CLI Connection Type'] = 'SSH'
    context.resource.attributes['User'] = '******'
    context.resource.attributes['AdminUser'] = '******'

    context.resource.attributes['Password'] = '******'
    context.resource.attributes['Enable Password'] = '******'
    context.resource.address = '192.168.73.41'
    context.resource.attributes['SNMP Version'] = '2'
    context.resource.attributes['SNMP Read Community'] = 'public'
    context.resource.attributes['Model'] = 'Brocade NOS Switch'
    context.resource.attributes['AdminPassword'] ='******'
    context.resource.attributes['Vendor'] = 'Brocade'

    context.connectivity = ConnectivityContext()
    context.connectivity.admin_auth_token = ''
    context.connectivity.cloudshell_api_port = '8029'
    context.connectivity.quali_api_port = '9000'
    context.connectivity.server_address = 'localhost'


    # context.connectivity.server_address='localhost'
    # context.description ={}
    # context.description['family'] = 'Router'
    # context.description['fullname'] = 'Huawei37'
    # context.description['id'] = 'b476fa1f-379e-435a-b35c-65e892e1c306'
    # context.description['model'] = 'Huaewi VRP Router'
    # context.description['name'] = 'Huawei37'

    return context
Exemplo n.º 6
0
def get_context():
    address = '10.5.1.127'
    user = '******'
    password = '******'
    reservation_id = 'b5c298ed-72c4-4379-b86d-4e43eb679b36'
    # port = 1222
    # enable_password = '******'
    # auth_key = 'h8WRxvHoWkmH8rLQz+Z/pg=='
    api_port = 8029

    context = ResourceCommandContext()
    context.resource = ResourceContextDetails()
    context.resource.name = 'dsada'
    context.resource.fullname = 'TestAireOS'
    context.reservation = ReservationContextDetails()
    context.reservation.reservation_id = reservation_id
    context.reservation.domain = 'Global'
    context.resource.attributes = {}
    context.resource.attributes['User'] = user
    context.resource.attributes['Password'] = password
    context.resource.attributes['host'] = address
    # context.resource.attributes['Enable Password'] = enable_password
    # context.resource.attributes['Port'] = port
    # context.resource.attributes['Backup Location'] = 'tftp://172.25.10.96/AireOS_test'
    context.resource.attributes[
        'Backup Location'] = 'ftp://*****:*****@192.168.85.23'
    context.resource.address = address
    context.connectivity = ConnectivityContext()
    # context.connectivity.admin_auth_token = auth_key
    context.connectivity.server_address = '10.5.1.2'
    context.connectivity.cloudshell_api_port = api_port
    context.resource.attributes['SNMP Version'] = '2'
    context.resource.attributes['SNMP Read Community'] = 'public'
    context.resource.attributes['CLI Connection Type'] = 'ssh'
    context.resource.attributes['Enable SNMP'] = 'False'
    context.resource.attributes['Disable SNMP'] = 'False'
    context.resource.attributes['CLI Connection Type'] = 'ssh'
    context.resource.attributes['Sessions Concurrency Limit'] = '1'
    return context
Exemplo n.º 7
0
                                                             reservation_id=reservation_id)

if __name__ == "__main__":
    import mock
    from cloudshell.shell.core.context import ResourceCommandContext, ResourceContextDetails, ReservationContextDetails

    address = '192.168.42.222'

    user = '******'
    password = '******'
    port = 443
    scheme = "https"
    auth_key = 'h8WRxvHoWkmH8rLQz+Z/pg=='
    api_port = 8029

    context = ResourceCommandContext()
    context.resource = ResourceContextDetails()
    context.resource.name = 'dd_5915-07f0'
    context.resource.fullname = 'dd_5915-07f0'
    context.reservation = ReservationContextDetails()
    context.reservation.reservation_id = '0cc17f8c-75ba-495f-aeb5-df5f0f9a0e97'
    context.resource.attributes = {}
    context.resource.attributes['User'] = user
    context.resource.attributes['Password'] = password
    context.resource.attributes['TVM Comms Network'] = "TVM_Comms_VLAN_99"
    context.resource.attributes['TVM MGMT Network'] = "TMV_Mgmt"
    context.resource.address = address
    context.resource.app_context = mock.MagicMock(app_request_json=json.dumps(
        {
            "deploymentService": {
                "cloudProviderName": "vCenter"
Exemplo n.º 8
0
      },
      "connectorAttributes" : [],
      "actionId" : "457238ad-4023-49cf-8943-219cb038c0dc_4244579e-bf6f-4d14-84f9-32d9cacaf9d9",
      "actionTarget" : {
        "fullName" : "2950/Chassis 0/FastEthernet0-23",
        "fullAddress" : "192.168.42.235/0/23",
        "type" : "actionTarget"
      },
      "customActionAttributes" : [],
      "type" : "setVlan"
    }
    ]
  }
}"""

context = ResourceCommandContext()
context.resource = ResourceContextDetails()
context.resource.name = 'dsada'
context.reservation = ReservationContextDetails()
context.reservation.reservation_id = 'test_id'
context.resource.attributes = {}
context.resource.attributes['User'] = '******'
context.resource.attributes['Password'] = '******'
context.resource.attributes['host'] = 'localhost'
context.resource.address = 'localhost'
context.connectivity = ConnectivityContext()
context.connectivity.admin_auth_token = 'asdas'
context.resource.attributes['SNMP Version'] = '2'
context.resource.attributes['SNMP Read Community'] = 'stargate'

context1 = ResourceCommandContext()
Exemplo n.º 9
0
# address = '192.168.28.150'
# address = '192.168.73.49'
# address = '192.168.73.20'
# address = '192.168.73.56'
# address = '172.29.168.56'
user = '******'
# user = '******'
# password = '******'
# password = '******'
password = '******'
port = 1222
enable_password = '******'
auth_key = 'h8WRxvHoWkmH8rLQz+Z/pg=='
api_port = 8029

context = ResourceCommandContext()
context.resource = ResourceContextDetails()
context.resource.name = 'dsada'
context.resource.fullname = 'TestAireOS'
context.reservation = ReservationContextDetails()
context.reservation.reservation_id = 'test_id'
context.resource.attributes = {}
context.resource.attributes['User'] = user
context.resource.attributes['Password'] = password
context.resource.attributes['host'] = address
context.resource.attributes['Enable Password'] = enable_password
context.resource.attributes['Port'] = port
# context.resource.attributes['Backup Location'] = 'tftp://172.25.10.96/AireOS_test'
context.resource.attributes[
    'Backup Location'] = 'ftp://*****:*****@192.168.85.16'
context.resource.address = address