Date created: Tuesday, October 4, 2016 5:24:54 PM. Last modified: Friday, January 13, 2017 11:44:03 AM

Example 2, Public Peering using OpenConfig (JSON over gRPC)

This example script requires the ID of a peering LAN from PeeringDB. It will then query the PeeringDB for all networks on that LAN and build up the OpenConfig BGP configuration to push to a network device to configure a peering sessions with all the peers on that IX peering LAN (it will serialise it to JSON and push over gRPC).

These OpenConf YANG modules need to be compiled using PyangBind for this example:

bensley@ubuntu-laptop:~/Python/pyb_xml/openconfig$ pyang --plugindir /usr/local/lib/python2.7/dist-packages/pyangbind/plugin -f pybind -o openconfig-bgp.py *.yang
bensley@ubuntu-laptop:~/Python/pyb_xml/openconfig$ ls -lh
total 23M
-rw-rw-r-- 1 bensley bensley  17K Nov  4 11:29 ietf-inet-types.yang
-rw-rw-r-- 1 bensley bensley  24K Nov  4 11:30 ietf-interfaces.yang
-rw-rw-r-- 1 bensley bensley  18K Nov  4 11:29 ietf-yang-types.yang
-rw-rw-r-- 1 bensley bensley  12K Nov  4 11:10 openconfig-bgp-common-multiprotocol.yang
-rw-rw-r-- 1 bensley bensley 4.5K Nov  4 11:11 openconfig-bgp-common-structure.yang
-rw-rw-r-- 1 bensley bensley  17K Nov  4 11:11 openconfig-bgp-common.yang
-rw-rw-r-- 1 bensley bensley 6.6K Nov  4 11:11 openconfig-bgp-global.yang
-rw-rw-r-- 1 bensley bensley  18K Nov  4 11:14 openconfig-bgp-neighbor.yang
-rw-rw-r-- 1 bensley bensley 6.4K Nov  4 11:16 openconfig-bgp-peer-group.yang
-rw-rw-r-- 1 bensley bensley  29K Nov  4 11:17 openconfig-bgp-policy.yang
-rw-rw-r-- 1 bensley bensley  23M Nov  4 11:30 openconfig-bgp.py
-rw-rw-r-- 1 bensley bensley  12K Nov  4 11:17 openconfig-bgp-types.yang
-rw-rw-r-- 1 bensley bensley 3.1K Nov  4 11:17 openconfig-bgp.yang
-rw-rw-r-- 1 bensley bensley 2.1K Nov  4 11:24 openconfig-extensions.yang
-rw-rw-r-- 1 bensley bensley  29K Nov  4 11:30 openconfig-interfaces.yang
-rw-rw-r-- 1 bensley bensley 4.3K Nov  4 11:24 openconfig-policy-types.yang
-rw-rw-r-- 1 bensley bensley  28K Nov  4 11:24 openconfig-routing-policy.ya

The script will generate the config for IPv4 and IPv6 sessions only for networks with an open peering policy. The final OpenConfig configuration is printed to the screen in JSON format and pushed to a Cisco IOS-XRv 6.2.1 device using Cisco's gRPC python client, for networks with a restrictive peering policy their details are printed so that they may be contacted. There is a caveat with this script (as its just a PoC) that if a network has two or more peering sessions to an IXP only one session is configured per network. Also note that when run against a very large exchange like the LINX London (Juniper / LON1) exchange, the script will take at least 5 minutes to run:

# Version 2.3 - 2016-11 - jwbensley  gmail  com
# Pre-reqs:
#
# Cisco gRPC Client is here:
# https://github.com/cisco-grpc-connection-libs/ios-xr-grpc-python
#
# pip install pyangbind
#
# Pyangbind compiled OpenConfig BGP YANG models:
# https://github.com/openconfig/public/tree/master/release/models/bgp
# plus IETF dependencies: ietf-inet-types.yang, ietf-interfaces.yang
# and ietf-yang-types.yang
#
# OpenConfig modules compiled from here:
# https://github.com/openconfig/public/tree/master/release/models


import sys
import urllib2
import json
import copy
from collections import OrderedDict
import pyangbind.lib.pybindJSON as pybindJSON
from openconfig_bgp import openconfig_bgp
from grpc.framework.interfaces.face.face import AbortionError
sys.path.insert(0, 'ios-xr-grpc-python-master/lib/')
from cisco_grpc_client import CiscoGRPCClient


default_v4_max = 100 # Default max v4 & v6 prefixes
default_v6_max = 100
default_shutdown_pct = 90 # Percent at which BGP session shutsdown
default_restart_timer = 1 # Default restart timer after shutdown (minutes)
default_v4_pg  = "public_v4_peers" # Default BGP peer groups
default_v6_pg  = "public_v6_peers"
default_v4_in_pol  = "public_v4_peering_ingress" # Default routing policies
default_v4_out_pol = "public_v4_peering_egress"  # These are not being used
default_v6_in_pol  = "public_v6_peering_ingress" # here, the peer groups are
default_v6_out_pol = "public_v6_peering_egress"  # instead.


class PeeringDB:


    def get_ixlan_id(self, ix_id):
        self.http_object = urllib2.urlopen("https://peeringdb.com/api/ix/%s" % ix_id)
        self.json_dict   = json.load(self.http_object)
        return self.json_dict["data"][0]["ixlan_set"][0]["id"]


    def get_ixlan(self, ixlan_id):
        self.http_object = urllib2.urlopen("https://peeringdb.com/api/ixlan/%s" % ixlan_id)
        self.json_dict   = json.load(self.http_object)
        return self.json_dict["data"][0]["net_set"]


    def get_ip_addrs(self, network):
        self.http_object  = urllib2.urlopen("https://peeringdb.com/api/net/%s" % network["id"])
        self.json_dict    = json.load(self.http_object)
        self.netixlan_set = self.json_dict["data"][0]["netixlan_set"]
        for self.netixlan in self.netixlan_set:
            if self.netixlan["ix_id"] == ix_id:
                network["ipaddr4"] = self.netixlan["ipaddr4"]
                network["ipaddr6"] = self.netixlan["ipaddr6"]
        return


    def get_net_pocs(self, network_id):
        self.http_object = urllib2.urlopen("https://peeringdb.com/api/net/%s" % network_id)
        self.json_dict   = json.load(self.http_object)
        return self.json_dict["data"][0]["poc_set"]


class IXPPeers:


    def __init__(self):
        self.open_networks  = {}        # E.g 5102 is Vostron
        self.restrictive_networks = {}  # E.g 14 is GTT 
        self.oc_bgp = openconfig_bgp()


    def enumerate_ixlan(self):
        for network in ixlan:

            if ((network["policy_general"] == "Open") or (network["policy_general"] == "Selective"))\
                and network["policy_ratio"] == 0:

                # The IPv4/6 address for this network on this LAN needs to be
                # pulled from the full net object
                peeringdb.get_ip_addrs(network)

                if (network["info_prefixes4"] == None) or (network["info_prefixes4"] == 0):
                    network["info_prefixes4"] = default_v4_max

                if (network["info_prefixes6"] == None) or (network["info_prefixes4"] == 0):
                    network["info_prefixes6"] = default_v6_max
            
                self.open_networks[len(self.open_networks)] = network


            # Restrictive peering network
            else:

                # We need to grab the full network object because the network
                # objects in the ixlan because net_set are missing the
                # point-of-contact details
                self.restrictive_networks[len(self.restrictive_networks)] = network
                self.restrictive_networks[len(self.restrictive_networks)-1]["poc_set"] = peeringdb.get_net_pocs(network["id"])


    def generate_oc_bgp(self):

        if (len(self.open_networks) == 0):
            print "None.\n"
            return

        for key, network in self.open_networks.items():
            if network["ipaddr4"] not in self.oc_bgp.bgp.neighbors.neighbor:
                self.oc_bgp.bgp.neighbors.neighbor.add(network["ipaddr4"])
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].config.neighbor_address = network["ipaddr4"]
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].config.description = network["name"]
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].config.peer_as = network["asn"]
                # NOT SUPPORTED ON IOS-XRv 6.2.1 ?
                #self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].config.enabled = "true"
                # NOT SUPPORTED ON IOS-XRv 6.2.1 ?
                #self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].config.remove_private_as = "PRIVATE_AS_REMOVE_ALL"
                # NOT SUPPORTED ON IOS-XRv 6.2.1 ?
                #self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].config.peer_type = "EXTERNAL"
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].config.peer_group = default_v4_pg
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].afi_safis.afi_safi.add("openconfig-bgp-types:IPV4_UNICAST")
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].afi_safis.afi_safi["openconfig-bgp-types:IPV4_UNICAST"].config.afi_safi_name = "IPV4_UNICAST"
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].afi_safis.afi_safi["openconfig-bgp-types:IPV4_UNICAST"].config.enabled = "true"
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].afi_safis.afi_safi["openconfig-bgp-types:IPV4_UNICAST"].ipv4_unicast.prefix_limit.config.max_prefixes = network["info_prefixes4"]
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].afi_safis.afi_safi["openconfig-bgp-types:IPV4_UNICAST"].ipv4_unicast.prefix_limit.config.shutdown_threshold_pct = default_shutdown_pct
                self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr4"]].afi_safis.afi_safi["openconfig-bgp-types:IPV4_UNICAST"].ipv4_unicast.prefix_limit.config.restart_timer = default_restart_timer

            if (network["info_ipv6"] == 1 and network["ipaddr6"] != None):
                if network["ipaddr6"] not in self.oc_bgp.bgp.neighbors.neighbor:
                    self.oc_bgp.bgp.neighbors.neighbor.add(network["ipaddr6"])
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].config.neighbor_address = network["ipaddr6"]
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].config.description = network["name"]
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].config.peer_as = network["asn"]
                    # NOT SUPPORTED ON IOS-XRv 6.2.1 ?
                    #self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].config.enabled = "true"
                    # NOT SUPPORTED ON IOS-XRv 6.2.1 ?
                    #self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].config.remove_private_as = "PRIVATE_AS_REMOVE_ALL"
                    # NOT SUPPORTED ON IOS-XRv 6.2.1 ?
                    #self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].config.peer_type = "EXTERNAL"
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].config.peer_group = default_v6_pg
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].afi_safis.afi_safi.add("openconfig-bgp-types:IPV6_UNICAST")
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].afi_safis.afi_safi["openconfig-bgp-types:IPV6_UNICAST"].config.afi_safi_name = "openconfig-bgp-types:IPV6_UNICAST"
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].afi_safis.afi_safi["openconfig-bgp-types:IPV6_UNICAST"].config.enabled = "true"
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].afi_safis.afi_safi["openconfig-bgp-types:IPV6_UNICAST"].ipv6_unicast.prefix_limit.config.max_prefixes = network["info_prefixes6"]
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].afi_safis.afi_safi["openconfig-bgp-types:IPV6_UNICAST"].ipv6_unicast.prefix_limit.config.shutdown_threshold_pct = default_shutdown_pct
                    self.oc_bgp.bgp.neighbors.neighbor[network["ipaddr6"]].afi_safis.afi_safi["openconfig-bgp-types:IPV6_UNICAST"].ipv6_unicast.prefix_limit.config.restart_timer = default_restart_timer
    

    def serialise_openconf_to_dict(self):
        # PyandBind will serialise to IEFT JSON..
        self.openconfig_json = json.loads(pybindJSON.dumps(self.oc_bgp, mode="ietf"))

        '''
        Two issues are now present:

        Firstly some of the syntax of the serialised JOSN is not accepted by IOS-XRv.
        Some of the OpenConfig BGP type definitions are using upper-case
        and IOS-XRv only seems to support lower case, for example
        "IPV4_UNICAST" AFI/SAFI must be "ipv4-unicast".

        Also the "restart-timer" is a float value in the OpenConfig type defs so ater
        being serialised from OC object to JSON the int is converted to a float,
        IOS-XRv wants an int so it is re-set below.
        '''

        for neighbor in self.openconfig_json["openconfig-bgp:bgp"]["neighbors"]["neighbor"]:

            if "afi-safi-name" in neighbor["afi-safis"]["afi-safi"][0]:
                if neighbor["afi-safis"]["afi-safi"][0]["afi-safi-name"] == "openconfig-bgp-types:IPV4_UNICAST":
                    neighbor["afi-safis"]["afi-safi"][0]["afi-safi-name"] = "openconfig-bgp-types:ipv4-unicast"

                elif neighbor["afi-safis"]["afi-safi"][0]["afi-safi-name"]=="openconfig-bgp-types:IPV6_UNICAST":
                    neighbor["afi-safis"]["afi-safi"][0]["afi-safi-name"] = "openconfig-bgp-types:ipv6-unicast"

            if "afi-safi-name" in neighbor["afi-safis"]["afi-safi"][0]["config"]:
                if neighbor["afi-safis"]["afi-safi"][0]["config"]["afi-safi-name"]=="openconfig-bgp-types:IPV4_UNICAST":
                    neighbor["afi-safis"]["afi-safi"][0]["config"]["afi-safi-name"] = "openconfig-bgp-types:ipv4-unicast"

                elif neighbor["afi-safis"]["afi-safi"][0]["config"]["afi-safi-name"]=="openconfig-bgp-types:openconfig-bgp-types:IPV6_UNICAST":
                    neighbor["afi-safis"]["afi-safi"][0]["config"]["afi-safi-name"] = "openconfig-bgp-types:ipv6-unicast"

            if "ipv4-unicast" in neighbor["afi-safis"]["afi-safi"][0]:
                if "restart-timer" in neighbor["afi-safis"]["afi-safi"][0]["ipv4-unicast"]["prefix-limit"]["config"]:
                    neighbor["afi-safis"]["afi-safi"][0]["ipv4-unicast"]["prefix-limit"]["config"]["restart-timer"] = default_restart_timer

            if "ipv6-unicast" in neighbor["afi-safis"]["afi-safi"][0]:
                if "restart-timer" in neighbor["afi-safis"]["afi-safi"][0]["ipv6-unicast"]["prefix-limit"]["config"]:
                    neighbor["afi-safis"]["afi-safi"][0]["ipv6-unicast"]["prefix-limit"]["config"]["restart-timer"] = default_restart_timer

            '''
            The second issue is that dict's are unordered and IOS-XRv wants the
            data in a specific order, so we need to re-order part of the dict,
            the "afi-safis" section:
            '''
            unsorted_afi_safis = copy.deepcopy(neighbor["afi-safis"]["afi-safi"][0])
            sorted_afi_safis = OrderedDict(sorted(unsorted_afi_safis.items(), key=lambda t: t[0]))
            neighbor["afi-safis"]["afi-safi"][0].clear()
            neighbor["afi-safis"]["afi-safi"][0] = copy.deepcopy(sorted_afi_safis)
            # Absolute filth ^

        return self.openconfig_json


    def print_restricted_peers(self):
        if (len(self.restrictive_networks) == 0):
            print "None.\n"
            return

        for key, network in peers.restrictive_networks.items():
            
            print ("Name:             {}\n"
                   "ASN:              {}\n"
                   "Policy:           {}\n"
                   "Policy Ratio:     {}\n"
                   "Policy Locations: {}\n"
                   "Policy URL:       {}\n"
                   "Policy Contracts: {}\n".
                   format(network["name"].encode('utf-8'), network["asn"], network["policy_general"],
                          network["policy_ratio"], network["policy_locations"], network["policy_url"],
                          network["policy_contracts"])
                   )
                   
            for poc in network["poc_set"]:
                print ("Role:  {}\n"
                       "Name:  {}\n"
                       "Phone: {}\n"
                       "Email: {}\n"
                       "URL:   {}\n".
                       format(poc["role"], poc["name"].encode('utf-8'), poc["phone"], poc["email"],
                              poc["url"])
                       )

        print "\n"


class gRPCOperations:


    def connect(self):
        creds = open('IOS-XRv621-grpc.pem').read()
        options = 'ems.cisco.com'
        self.client = CiscoGRPCClient('127.0.0.1', 57777, 10, 'vagrant', 'vagrant', creds, options)


    def get_bgp_config(self):
        path = '{"bgp:bgp": [null]}'
        try:
            err, result = self.client.getconfig(path)
            if err:
                print err
            print json.dumps(json.loads(result), indent=4)
        except AbortionError:
            print "Unable to connect to gRPC server"


    def merge_config_json(self, json_config):
        try:
            response = self.client.mergeconfig(json_config)
            if response.errors:
                err = json.loads(response.errors)
                print err
                raise SystemExit
        except AbortionError:
            print "Unable to connect to gRPC server"


if __name__ == "__main__":

    # E.g 1016 is LINX IXCardiff LAN
    if (len(sys.argv) < 2 or (len(sys.argv) == 2 and int(sys.argv[1]) < 1) ):
        print "Missing peeringDB IX ID\n"
        raise SystemExit

    # Set up ...
    ix_id       = int(sys.argv[1])
    peeringdb   = PeeringDB()
    peers       = IXPPeers()
    grpc_client = gRPCOperations()

    # Call the peeringDB API to get the ixlan object based on ID
    ixlan_id  = peeringdb.get_ixlan_id(int(sys.argv[1]))
    ixlan     = peeringdb.get_ixlan(ixlan_id)
    
    # Enumerate open peering networks on the ixlan
    peers.enumerate_ixlan()

    # Populate the OpenConfig YANG modules to create BGP sessions with each open peer
    peers.generate_oc_bgp()

    # Serialise the OpenConfig data to JSON
    print "Open peering networks:"
    json_config = peers.serialise_openconf_to_dict()
    print json.dumps(json_config, indent=4),"\n"

    # Send OpenConfig data to the device serialised as JSON over gRPC transport
    grpc_client.connect()
    print "Running BGP config before:"
    grpc_client.get_bgp_config()
    print "\n"

    grpc_client.merge_config_json(json.dumps(json_config))
    
    print "Running BGP config after:"
    grpc_client.get_bgp_config()
    print "\n"

    # Print out contact details for restrictive peers
    print "Restrictive peering networks:"
    peers.print_restricted_peers()
bensley@ubuntu-laptop:~/Python/pyb_oc$ python peeringdb-example-2.3.py 40

Open peering networks:
{
    "openconfig-bgp:bgp": {
        "neighbors": {
            "neighbor": [
                {
                    "neighbor-address": "2001:7f8:2d:e:2:0:2686:1", 
                    "config": {
                        "neighbor-address": "2001:7f8:2d:e:2:0:2686:1", 
                        "peer-as": 2686, 
                        "peer-group": "public_v6_peers", 
                        "description": "AT&T EMEA - AS2686"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv6-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv6-unicast"
                                }, 
                                "ipv6-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 500
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "193.251.216.17", 
                    "config": {
                        "neighbor-address": "193.251.216.17", 
                        "peer-as": 2484, 
                        "peer-group": "public_v4_peers", 
                        "description": "FR-NIC-DNS (AFNIC / NIC-France)"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv4-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv4-unicast"
                                }, 
                                "ipv4-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 10
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "193.251.216.13", 
                    "config": {
                        "neighbor-address": "193.251.216.13", 
                        "peer-as": 2686, 
                        "peer-group": "public_v4_peers", 
                        "description": "AT&T EMEA - AS2686"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv4-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv4-unicast"
                                }, 
                                "ipv4-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 1000
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "2001:860:0:6::8359:1", 
                    "config": {
                        "neighbor-address": "2001:860:0:6::8359:1", 
                        "peer-as": 8359, 
                        "peer-group": "public_v6_peers", 
                        "description": "Mobile TeleSystems PJSC"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv6-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv6-unicast"
                                }, 
                                "ipv6-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 500
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "198.32.247.60", 
                    "config": {
                        "neighbor-address": "198.32.247.60", 
                        "peer-as": 39196, 
                        "peer-group": "public_v4_peers", 
                        "description": "Broadcasting Center Europe (BCE pop in France)"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv4-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv4-unicast"
                                }, 
                                "ipv4-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 1
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "2001:7f8:2d:c:2:3:4019:1", 
                    "config": {
                        "neighbor-address": "2001:7f8:2d:c:2:3:4019:1", 
                        "peer-as": 34019, 
                        "peer-group": "public_v6_peers", 
                        "description": "Hivane"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv6-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv6-unicast"
                                }, 
                                "ipv6-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 50
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "193.251.216.18", 
                    "config": {
                        "neighbor-address": "193.251.216.18", 
                        "peer-as": 34019, 
                        "peer-group": "public_v4_peers", 
                        "description": "Hivane"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv4-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv4-unicast"
                                }, 
                                "ipv4-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 100
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "193.251.216.70", 
                    "config": {
                        "neighbor-address": "193.251.216.70", 
                        "peer-as": 4589, 
                        "peer-group": "public_v4_peers", 
                        "description": "Easynet Global Services"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv4-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv4-unicast"
                                }, 
                                "ipv4-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 1000
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "2001:7f8:2d:0:2:0:2486:1", 
                    "config": {
                        "neighbor-address": "2001:7f8:2d:0:2:0:2486:1", 
                        "peer-as": 2484, 
                        "peer-group": "public_v6_peers", 
                        "description": "FR-NIC-DNS (AFNIC / NIC-France)"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv6-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv6-unicast"
                                }, 
                                "ipv6-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 1
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "2001:7f8:2d:f:2:0:4589:1", 
                    "config": {
                        "neighbor-address": "2001:7f8:2d:f:2:0:4589:1", 
                        "peer-as": 4589, 
                        "peer-group": "public_v6_peers", 
                        "description": "Easynet Global Services"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv6-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv6-unicast"
                                }, 
                                "ipv6-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 50
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "198.32.247.107", 
                    "config": {
                        "neighbor-address": "198.32.247.107", 
                        "peer-as": 15436, 
                        "peer-group": "public_v4_peers", 
                        "description": "Witbe"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv4-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv4-unicast"
                                }, 
                                "ipv4-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 20
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "193.251.216.102", 
                    "config": {
                        "neighbor-address": "193.251.216.102", 
                        "peer-as": 7500, 
                        "peer-group": "public_v4_peers", 
                        "description": "M-ROOT DNS Server"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv4-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv4-unicast"
                                }, 
                                "ipv4-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 6
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "2001:7f8:2d:1:2:0:7500:1", 
                    "config": {
                        "neighbor-address": "2001:7f8:2d:1:2:0:7500:1", 
                        "peer-as": 7500, 
                        "peer-group": "public_v6_peers", 
                        "description": "M-ROOT DNS Server"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv6-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv6-unicast"
                                }, 
                                "ipv6-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 0
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }, 
                {
                    "neighbor-address": "62.35.254.148", 
                    "config": {
                        "neighbor-address": "62.35.254.148", 
                        "peer-as": 8359, 
                        "peer-group": "public_v4_peers", 
                        "description": "Mobile TeleSystems PJSC"
                    }, 
                    "afi-safis": {
                        "afi-safi": [
                            {
                                "afi-safi-name": "openconfig-bgp-types:ipv4-unicast", 
                                "config": {
                                    "enabled": true, 
                                    "afi-safi-name": "openconfig-bgp-types:ipv4-unicast"
                                }, 
                                "ipv4-unicast": {
                                    "prefix-limit": {
                                        "config": {
                                            "shutdown-threshold-pct": 90, 
                                            "restart-timer": 1, 
                                            "max-prefixes": 10000
                                        }
                                    }
                                }
                            }
                        ]
                    }
                }
            ]
        }
    }
}

Restrictive peering networks:
Name:             Verizon Business - EMEA
ASN:              702
Policy:           Restrictive
Policy Ratio:     True
Policy Locations: Required - International
Policy URL:       http://www.verizonbusiness.com/peering
Policy Contracts: Required

Name:             Orange
ASN:              5511
Policy:           Restrictive
Policy Ratio:     True
Policy Locations: Required - International
Policy URL:       http://vision.opentransit.net/docs/peering_policy/
Policy Contracts: Required

Name:             V-Com Openpath
ASN:              29215
Policy:           Restrictive
Policy Ratio:     False
Policy Locations: Preferred
Policy URL:       
Policy Contracts: Not Required

Name:             Orange France
ASN:              3215
Policy:           Restrictive
Policy Ratio:     True
Policy Locations: Preferred
Policy URL:       http://www.parix.net/Politique-peering-FT-AS3215.pdf
Policy Contracts: Not Required

Name:             Savvis
ASN:              3561
Policy:           Restrictive
Policy Ratio:     True
Policy Locations: Required - US
Policy URL:       http://www.savvis.net/corp/savvis/peering
Policy Contracts: Required

Name:             Pertineo
ASN:              39583
Policy:           Selective
Policy Ratio:     True
Policy Locations: Not Required
Policy URL:       
Policy Contracts: Required

Previous page: Example 1, Find Matching PoPs
Next page: Scapy Examples