def test_credentials_not_provided(self, mock_login):
        print("targeted test")
        config = {"ip": "172.0.0.1"}

        with self.assertRaises(exceptions.HPESimpliVityException) as error:
            OVC(config)

        self.assertEqual(error.exception.msg, "Credentials not provided")
Example #2
0
    def setUp(self, mock_login):
        super(OVCTest, self).setUp()

        config = {"ip": "10.30.4.245",
                  "credentials": {
                      "username": "******",
                      "password": "******"}}

        self._ovc = OVC(config)
Example #3
0
    def _create_simplivity_client(self):
        """
        Creates Simplivity client object using module prams/env variables/config file
        """
        if self.module.params.get('ovc_ip'):
            config = dict(ip=self.module.params['ovc_ip'],
                          credentials=dict(
                              username=self.module.params['username'],
                              password=self.module.params['password']))
            self.ovc_client = OVC(config)

        elif not self.module.params['config']:
            self.ovc_client = OVC.from_environment_variables()
        else:
            self.ovc_client = OVC.from_json_file(self.module.params['config'])
Example #4
0
import time
from simplivity.ovc_client import OVC
from simplivity.exceptions import HPESimpliVityException
import pprint

config = {
    "ip": "<ovc_ip>",
    "credentials": {
        "username": "******",
        "password": "******"
    }
}

pp = pprint.PrettyPrinter(indent=4)

ovc = OVC(config)
backups = ovc.backups
machines = ovc.virtual_machines
datastores = ovc.datastores

# variable declaration
test_vm_name = "test_MySql-VM_restore"
remote_datastore = "remoteDS"
cluster1_name = "CC_Virt_0001"
cluster2_name = "CC_Virt_0000"

print("\n\nget_all with default params")
all_backups = backups.get_all()
count = len(all_backups)
for backup in all_backups:
    print(f"{backup}")