Beispiel #1
0
def bgp_run(netconf_service, session):
    # set up routing policy definition
    routing_policy = _get_routing_cfg()
    netconf_service.edit_config(session, Datastore.candidate, routing_policy)

    bgp_cfg = _get_bgp_config()
    # IPv4 Neighbor instance config done
    netconf_service.edit_config(session, Datastore.candidate, bgp_cfg)

    bgp_cfg_read = netconf_service.get_config(session, Datastore.candidate, bgp.Bgp())
    print(bgp_cfg_read)

    # IPv6 Neighbor instance config
    nbr_ipv6 = bgp.Bgp.Neighbors.Neighbor()
    nbr_ipv6.parent = bgp_cfg.neighbors
    nbr_ipv6.neighbor_address = '2001:db8:fff1::1'
    nbr_ipv6.config.neighbor_address = '2001:db8:fff1::1'
    nbr_ipv6.config.peer_as = 65002

    nbr_ipv6_afsf = nbr_ipv6.afi_safis.AfiSafi()
    nbr_ipv6_afsf.afi_safi_name = openconfig_bgp_types.Ipv6UnicastIdentity()
    nbr_ipv6_afsf.config.peer_as = 65002
    nbr_ipv6_afsf.config.afi_safi_name = openconfig_bgp_types.Ipv6UnicastIdentity()
    nbr_ipv6_afsf.config.enabled = True

    nbr_ipv6.afi_safis.afi_safi.append(nbr_ipv6_afsf)

    netconf_service.edit_config(session, Datastore.candidate, bgp_cfg)

    nbr_ipv6_filter = bgp.Bgp.Neighbors.Neighbor()
    nbr_ipv6_filter.neighbor_address = '2001:db8:fff1::1'

    nbr_ipv6_read = netconf_service.get_config(session, Datastore.candidate, bgp_cfg)

    print(nbr_ipv6_read)
Beispiel #2
0
def bgp_run(netconf_service, session):
    # set up routing policy definition
    routing_policy = _get_routing_cfg()
    netconf_service.edit_config(session, Datastore.candidate, routing_policy)

    bgp_cfg = _get_bgp_config()
    # IPv4 Neighbor instance config done
    netconf_service.edit_config(session, Datastore.candidate, bgp_cfg)

    bgp_cfg_read = netconf_service.get_config(session, Datastore.candidate, bgp.Bgp())
    print(bgp_cfg_read)

    # IPv6 Neighbor instance config
    nbr_ipv6 = bgp.Bgp.Neighbors.Neighbor()
    nbr_ipv6.parent = bgp_cfg.neighbors
    nbr_ipv6.neighbor_address = '2001:db8:fff1::1'
    nbr_ipv6.config.neighbor_address = '2001:db8:fff1::1'
    nbr_ipv6.config.peer_as = 65002

    nbr_ipv6_afsf = nbr_ipv6.afi_safis.AfiSafi()
    nbr_ipv6_afsf.afi_safi_name = openconfig_bgp_types.Ipv6Unicast()
    nbr_ipv6_afsf.config.peer_as = 65002
    nbr_ipv6_afsf.config.afi_safi_name = openconfig_bgp_types.Ipv6Unicast()
    nbr_ipv6_afsf.config.enabled = True

    nbr_ipv6.afi_safis.afi_safi.append(nbr_ipv6_afsf)

    netconf_service.edit_config(session, Datastore.candidate, bgp_cfg)

    nbr_ipv6_filter = bgp.Bgp.Neighbors.Neighbor()
    nbr_ipv6_filter.neighbor_address = '2001:db8:fff1::1'

    nbr_ipv6_read = netconf_service.get_config(session, Datastore.candidate, bgp_cfg)

    print(nbr_ipv6_read)
Beispiel #3
0
def run_routing(codec_service, provider):
    routing_policy = _get_routing_cfg()
    routing_payload = codec_service.encode(provider, routing_policy)
    print(routing_payload)
    routing_entity = codec_service.decode(provider, routing_payload)
    assert routing_payload == codec_service.encode(provider, routing_entity)
Beispiel #4
0
def run_routing(codec_service, provider):
    routing_policy = _get_routing_cfg()
    routing_payload = codec_service.encode(provider, routing_policy)
    print(routing_payload)
    routing_entity = codec_service.decode(provider, routing_payload)
    assert routing_payload == codec_service.encode(provider, routing_entity)