How to use the cvprac.cvp_client.CvpClient function in cvprac

To help you get started, we’ve selected a few cvprac examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ansible / ansible / lib / ansible / modules / network / cloudvision / cv_server_provision.py View on Github external
def connect(module):
    ''' Connects to CVP device using user provided credentials from playbook.

    :param module: Ansible module with parameters and client connection.
    :return: CvpClient object with connection instantiated.
    '''
    client = CvpClient()
    try:
        client.connect([module.params['host']],
                       module.params['username'],
                       module.params['password'],
                       protocol=module.params['protocol'],
                       port=module.params['port'])
    except CvpLoginError as e:
        module.fail_json(msg=str(e))
    return client
github aristanetworks / CloudVisionPortal-Examples / GitConfigletSync / GitConfigletSync.py View on Github external
# Path for git workspace (include trailing /)
gitTempPath = '/tmp/GitConfiglets/'
gitRepo = 'https://github.com/terensapp/cvpbackup'
gitBranch = 'master'
# Relative path within the repo to the configlet directory, leave blank if they reside in the root
configletPath = ''
ignoreConfiglets = ['.git','.md']
# cvpNodes can be a single item or a list of the cluster
cvpNodes = ['54.193.119.19']
cvpUsername = 'arista'
cvpPassword = 'arista'


# Initialize the client
cvpClient = CvpClient()

# Attempt to connect to CVP, if it's not available wait 60 seconds
attempts = 0
while 1:
   try: 
      cvpClient.connect(cvpNodes, cvpUsername, cvpPassword)
      if cvpClient.api.get_cvp_info()['version']:
         break
   except:
      attempts += 1
      print "Cannot connect to CVP waiting 1 minute attempt",attempts
      time.sleep(60)


# Function to sync configlet to CVP
def syncConfiglet(cvpClient,configletName,configletConfig):

cvprac

Arista Cloudvision(R) Portal Rest API Client written in python

BSD-3-Clause
Latest version published 7 months ago

Package Health Score

59 / 100
Full package analysis

Similar packages