Example #1
0
def main():
    if(sys.argv < 1):
        print("Usage: python insert_route.py ODL_IP_address router_IP_address destination_prefix")
        exit(1)
        
    # Store command line arguments
    #odl_ip = sys.argv[1]
    #input_source_ip = sys.argv[2]
    #destination_prefix = sys.argv[3]

    odl_ip = "localhost"
    #input_router_ip = "198.18.1.30"
    destination_prefix = '10.210.210.1/32'

    print("Starting insert_route")

    # Get device name from the source IP address
    #print("Getting device name from IP address %s" % (input_router_ip))
    #found = False
    #for (device_name, device_config) in settings.config['network_device'].items():
    #    address = device_config['address']
    #    if(address == input_router_ip):
    #        source_name = device_name
    #        found = True
    #        break
    
    #if(not found):
    #    print("Input source IP %s could not be found among the list of devices" % (input_source_ip))
    #    exit(1)

    # Set the next hop in the attributes for the prefix
    print("Setting attributes")
    prefix_attributes = attributes()
    prefix_attributes.set_next_hop('1.2.3.4')
    
    # Create an app route
    print("Creating ipv4 unicast route for %s" % (destination_prefix))
    route = app_route(odl_ip)
    
    print("Setting route to %s" % (destination_prefix))
    
    # Put the app route into the controller
    route.put_app_route(destination_prefix, prefix_attributes.get())
        
    print("Route Set => Connection closed to %s\n" % (destination_prefix))
def main():
    if(sys.argv < 1):
        print("Usage: python insert_route.py ODL_IP_address router_IP_address destination_prefix")
        exit(1)
        
    # Store command line arguments
    #odl_ip = sys.argv[1]
    #destination_prefix = sys.argv[2]

    odl_ip = "localhost"
    destination_prefix = '10.210.210.1/32'
    
    # Create an app route
    route = app_route(odl_ip)
    
    # Delete the app route from the controller
    print("Deleting route going to %s from the controller %s" % (destination_prefix, odl_ip))
    route.del_app_route(destination_prefix)
    
    print("Route deleted => Connection open to %s\n" % (destination_prefix))
Example #3
0
def main():
    if (sys.argv < 1):
        print(
            "Usage: python insert_route.py ODL_IP_address router_IP_address destination_prefix"
        )
        exit(1)

    # Store command line arguments
    #odl_ip = sys.argv[1]
    #destination_prefix = sys.argv[2]

    odl_ip = "localhost"
    destination_prefix = '10.210.210.1/32'

    # Create an app route
    route = app_route(odl_ip)

    # Delete the app route from the controller
    print("Deleting route going to %s from the controller %s" %
          (destination_prefix, odl_ip))
    route.del_app_route(destination_prefix)

    print("Route deleted => Connection open to %s\n" % (destination_prefix))
#!/usr/bin/env python
from v4_uni_app_route import app_route
import sys

controller = sys.argv[1]
prefix = sys.argv[2]

# initialise route
route = app_route(controller)

# delete route
route.del_app_route(prefix)
#!/usr/bin/env python
from route_attributes import attributes
from v4_uni_app_route import app_route

attrib = attributes()
route = app_route("172.23.29.120")

attrib.set_communities("100:100")
attrib.set_next_hop("172.23.29.120")

print attrib

route.put_app_route("1.2.3.4/32", attrib.get())
Example #6
0
#!/usr/bin/env python
from router_attributes import attributes
from v4_uni_app_route import app_route

attrib = attributes()
route = app_route("localhost")

#attrib.set_communities("100:100")
attrib.set_next_hop("192.0.2.1")

print attrib

route.del_app_route("45.0.0.27/32")
Example #7
0
#!/usr/bin/env python
from route_attributes import attributes
from v4_uni_app_route import app_route
import sys

controller = sys.argv[1]
prefix = sys.argv[2]

# initialise route object
route = app_route(controller)

# set route attributes
attrib = attributes()
attrib.set_communities("100:100")
attrib.set_next_hop(controller)

# advertise route
route.put_app_route(prefix, attrib.get())