Example #1
0
def main():
    # The below import module(s) were placed in the main function for backward compatibility
    from apicLogin import aaaLogin

    # Statically specify the APIC URL, if not executing script via CLI
    DefaultApicUrl = 'sandboxapicdc.cisco.com'
    login = '******'
    passwd = 'ciscopsdt'
    new_tenant = '20201113-01'
    # login = input('Enter username to connect with: ')
    # passwd = getpass.getpass("Enter password: "******"The tenant to be created.")

    args = parser.parse_args()

    if args.tenant is not None:
        new_tenant = args.tenant

    base_url = f"https://{DefaultApicUrl}"

    # Get the authorization cookie from the APIC
    cookies = aaaLogin(DefaultApicUrl, login, passwd)

    # Create the tenant
    response_data = createtenant(base_url, cookies, new_tenant)
Example #2
0
def main():
    # The below import module(s) were placed in the main function for backward compatibility
    from apicLogin import aaaLogin

    # Statically specify the APIC URL, if not executing script via CLI
    DefaultApicUrl = 'sandboxapicdc.cisco.com'
    login = '******'
    passwd = '!v3G@!4@Y'

    ymlfilename = r'\vepgs.csv'

    #login = input('Enter username to connect with: ')
    #passwd = getpass.getpass("Enter password: "******"Defines the name if the VLAN pool")
    parser.add_argument(
        '--pooltype',
        '-p',
        action='store',
        help=
        "Defines if the VLAN Pool Type should be 'static' or 'dynamic' assigned"
    )
    parser.add_argument(
        '--file',
        '-f',
        action='store',
        help=
        "The input file of VLANs. The file should only have VLAN numbers, each on a \
        different line with no seperator other than a line break")
    args = parser.parse_args()

    # Doing some arg magic so this can be ran with bACI.py or standalone
    if args.file == None:
        dir_path = os.path.dirname(os.path.realpath(__file__))
        ymlfile = dir_path + ymlfilename
        args.file = ymlfile
    if args.name == None:
        args.name = vlanpoolname
    if args.pooltype == None:
        args.pooltype = assignmethod

    base_url = f"https://{DefaultApicUrl}"

    # Build the JSON for the post to APIC
    #### CREATE ME!!###
    json_object = buildJSON(args)

    # Get the authorization cookie from the APIC
    cookies = aaaLogin(DefaultApicUrl, login, passwd)

    # Do the work
    deployEPG(base_url, cookies, args, json_object)
Example #3
0
def main():
    # The below import module(s) were placed in the main function for backward compatibility
    from apicLogin import aaaLogin

    # Statically specify the APIC URL, if not executing script via CLI
    DefaultApicUrl = 'sandboxapicdc.cisco.com'
    login = '******'
    passwd = 'ciscopsdt'

    # login = input('Enter username to connect with: ')
    # passwd = getpass.getpass("Enter password: "******"The IP or URL of the APIC controller. This should not include \
            http(s) or a trailing backslash.")

    args = parser.parse_args()
    apicUrl = args.apic

    if apicUrl is None:
        apicUrl = DefaultApicUrl
    base_url = f"https://{apicUrl}"

    # Get the login token
    cookies = aaaLogin(apicUrl, login, passwd)

    # Get the endpoints
    endpoint_data = getendpoints(base_url, cookies)

    # Cleanup the endpoint info
    clean_endpoint = cleanendpoints(endpoint_data)
    print(clean_endpoint)