Exemple #1
0
    def __init__(self, ips):

        self.ips = ips
        self.rib = {
            "input": rib("-".join(ips), "input"),
            "local": rib("-".join(ips), "local")
        }
Exemple #2
0
 def __init__(self, asn, ports, peers_in, peers_out):
     
     self.asn = asn
     self.ports = ports
     
     ips = []
     for port in ports:
         ips.append(port["IP"])
     
     self.rib = {"input": rib("-".join(ips),"input"),
                 "local": rib("-".join(ips),"local"),
                 "output": rib("-".join(ips),"output")}
                 
     # peers that a participant accepts traffic from and sends advertisements to            
     self.peers_in = peers_in
     # peers that the participant can send its traffic to and gets advertisements from
     self.peers_out = peers_out
Exemple #3
0
    def __init__(self, asn, ports, peers_in, peers_out):

        self.asn = asn
        self.ports = ports

        ips = []
        for port in ports:
            ips.append(port["IP"])

        self.rib = {
            "input": rib("-".join(ips), "input"),
            "local": rib("-".join(ips), "local"),
            "output": rib("-".join(ips), "output")
        }

        # peers that a participant accepts traffic from and sends advertisements to
        self.peers_in = peers_in
        # peers that the participant can send its traffic to and gets advertisements from
        self.peers_out = peers_out
Exemple #4
0
    def __init__(self, id, asn, ports, peers_in, peers_out):
        self.id = id
        self.asn = asn
        self.ports = ports
        self.logger = log.getLogger('P' + str(self.id) + '-peer')

        self.rib = rib(self.asn)

        # peers that a participant accepts traffic from and sends advertisements to
        self.peers_in = peers_in
        # peers that the participant can send its traffic to and gets advertisements from
        self.peers_out = peers_out
Exemple #5
0
 def __init__(self, asn, ports, peers_in, peers_out, fwd_peers):
     
     self.asn = asn
     self.ports = ports
     
     ips = []
     for port in ports:
         ips.append(port["IP"])
     
     self.rib = {"input": rib("-".join(ips),"input"),
                 "local": rib("-".join(ips),"local"),
                 "output": rib("-".join(ips),"output")}
                 
     # peers that a participant accepts traffic from and sends advertisements to            
     self.peers_in = peers_in
     # peers that the participant can send its traffic to and gets advertisements from
     self.peers_out = peers_out
     # peers that the participant is actually sending traffic to based on the policies
     self.fwd_peers = fwd_peers
     # peers that the participant is not allowed to send any traffic to to avoid loops
     self.no_fwd_peers = {}
    ip = "128.64.32.16"
    ip_as_long = 0x80402010
    if (ip_as_long != ip_to_long(ip)):
        print "ip_to_long() failed"
        failed_tests += 1
    else:
        passed_tests += 1
    if (ip != long_to_ip(ip_as_long)):
        print "long_to_ip() failed"
        failed_tests += 1
    else:
        passed_tests += 1

    # BPS
    # Starting part is from the RIB module
    myrib = rib('172.0.0.1',"testing")
    
    myrib['100.0.0.1/16'] = ('172.0.0.2', 'igp', '100, 200, 300', '0', 'false')
    #myrib['100.0.0.1/16'] = ['172.0.0.2', 'igp', '100, 200, 300', '0', 'false']
    #myrib['100.0.0.1/16'] = {'next_hop':'172.0.0.2', 'origin':'igp', 'as_path':'100, 200, 300',
    #                          'med':'0', 'atomic_aggregate':'false'}
    myrib.commit()
    
    myrib.update('100.0.0.1/16', 'next_hop', '190.0.0.2')
    myrib.commit()
    
    print decision_process(myrib,"100.0.0.1/16")

    print "Passed:", passed_tests
    print "Failed:", failed_tests
Exemple #7
0
    ip = "128.64.32.16"
    ip_as_long = 0x80402010
    if (ip_as_long != ip_to_long(ip)):
        print "ip_to_long() failed"
        failed_tests += 1
    else:
        passed_tests += 1
    if (ip != long_to_ip(ip_as_long)):
        print "long_to_ip() failed"
        failed_tests += 1
    else:
        passed_tests += 1

    # BPS
    # Starting part is from the RIB module
    myrib = rib('172.0.0.1',"testing")

    myrib['100.0.0.1/16'] = ('172.0.0.2', 'igp', '100, 200, 300', '0', 'false')
    #myrib['100.0.0.1/16'] = ['172.0.0.2', 'igp', '100, 200, 300', '0', 'false']
    #myrib['100.0.0.1/16'] = {'next_hop':'172.0.0.2', 'origin':'igp', 'as_path':'100, 200, 300',
    #                          'med':'0', 'atomic_aggregate':'false'}
    myrib.commit()

    myrib.update('100.0.0.1/16', 'next_hop', '190.0.0.2')
    myrib.commit()

    print decision_process(myrib,"100.0.0.1/16")

    print "Passed:", passed_tests
    print "Failed:", failed_tests
Exemple #8
0
 def __init__(self,ips):
     
     self.ips = ips
     self.rib = {"input": rib("-".join(ips),"input"),
                 "local": rib("-".join(ips),"local")}