コード例 #1
0
def main():
    session = Session(URL, LOGIN, PASSWORD)
    session.login()

    test = Org('sample-org')
    session.push_to_dcnm(test.get_url(), test.get_json())

    p1 = Partition('sample', test)
    session.push_to_dcnm(p1.get_url(), p1.get_json())
    n1 = Network('net1', p1)
    n1.segmentId = 333
    n1.vlanId = n1.segmentId
    session.push_to_dcnm(n1.get_url(), n1.get_json())
コード例 #2
0
def main():
    session = Session(URL, LOGIN, PASSWORD)
    session.login()

    test = Org('sample-org')
    session.push_to_dcnm(test.get_url(), test.get_json())

    p1 = Partition('sample', test)
    session.push_to_dcnm(p1.get_url(), p1.get_json())
    n1 = Network('net1', p1)
    n1.segmentId = 333
    n1.vlanId = n1.segmentId
    session.push_to_dcnm(n1.get_url(), n1.get_json())
コード例 #3
0
def main(url=None, cert=None):
    """My Main"""
    poap_url = '/rest/poap/definitions'
    session = Session(url, LOGIN, PASSWORD, logging_lvl='INFO', verify=cert)
    session.login()

    fabric_elements = ['BorderLeaf', 'DatacenterCore', 'Spine', 'Leaf', 'BorderGateway']

    for switch_definitions in fabric_elements:
        for definitions in FABRIC[switch_definitions]:
            if switch_definitions is 'Spine' or switch_definitions is 'DatacenterCore':
                template_name = 'IPFabric_N9K_Spine_10_2_1_ST_1_TAG'
                template_params = POAP_SPINE_TMPL['templateDetails'][0]['templateParams']
            else:
                template_name = 'IPFabric_N9K_Leaf_10_2_1_ST_1_TAG'
                template_params = POAP_LEAF_TMPL['templateDetails'][0]['templateParams']

            switch_details = SwitchDetails(definitions=definitions)
            template_params = TemplateDetails(template_params=template_params, definitions=definitions)
            body = build_poap_def(switch_details.get_details(), template_name, template_params.get_details())
            resp = session.push_to_dcnm(poap_url, json.dumps(body))

            logging.info('HTTP POST response %s' % resp)