Beispiel #1
0
def main(argv=None):
    if not argv:
        argv = sys.argv

    print 'Start the test environment'
    print '=== OFv3AdvertisementFormatter ==='

    rspec = OFv3AdvertisementFormatter()
    prefix = "urn:publicid:IDN+openflow:foam:foam.gpolab.bbn.com+"
    of_node = OpenFlowNode(prefix + "datapath:06:d6:00:24:a8:c4:b9:00",
                           prefix + "authority+am",
                           "06:d6:00:24:a8:c4:b9:00",
                           "false",
                           "true")
    of_node.add_port(3, "GBE0/3")
    of_node.add_port(5, "GBE0/5")
    of_node.add_port(9, "GBE0/9")
    of_node.add_port(20, "GBE0/20")
    of_node.add_port(22, "GBE0/22")
    of_node.add_port(666)
    rspec.datapath(of_node)

    of_node = OpenFlowNode(prefix + "datapath:06:d6:00:24:a8:c4:cc:ff",
                           prefix + "authority+am",
                           "06:d6:00:24:a8:c4:cc:ff",
                           "false",
                           "true")
    of_node.add_port(11, "pippo")
    of_node.add_port(45, "pluto")
    rspec.datapath(of_node)

    print rspec
    (result, error) = validate(rspec.get_rspec())
    if not result:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    print '=== OFv3RequestParser ==='
    rspec = OFv3AdvertisementParser("adv_rspec_example.xml")

    (result, error) = validate(rspec.get_rspec())
    if not result:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    nodes = rspec.nodes()
    print "Nodes(%d)=%s" % (len(nodes), nodes)

    ofnodes = rspec.ofnodes()
    print "OFNodes(%d)=%s" % (len(ofnodes), ofnodes)

    for ofn in ofnodes:
        ofnode = ofn.get("ofnode")
        print "DPID=%s" % ofnode.dpid
        print "PORTS=%s" % ofnode.ports

    print 'Bye Bye...'
    return True
Beispiel #2
0
def main(argv=None):
    if not argv:
        argv = sys.argv

    print 'Start the test environment'
    print '=== OFv3AdvertisementFormatter ==='

    rspec = OFv3AdvertisementFormatter()
    prefix = "urn:publicid:IDN+openflow:foam:foam.gpolab.bbn.com+"
    of_node = OpenFlowNode(prefix + "datapath:06:d6:00:24:a8:c4:b9:00",
                           prefix + "authority+am", "06:d6:00:24:a8:c4:b9:00",
                           "false", "true")
    of_node.add_port(3, "GBE0/3")
    of_node.add_port(5, "GBE0/5")
    of_node.add_port(9, "GBE0/9")
    of_node.add_port(20, "GBE0/20")
    of_node.add_port(22, "GBE0/22")
    of_node.add_port(666)
    rspec.datapath(of_node)

    of_node = OpenFlowNode(prefix + "datapath:06:d6:00:24:a8:c4:cc:ff",
                           prefix + "authority+am", "06:d6:00:24:a8:c4:cc:ff",
                           "false", "true")
    of_node.add_port(11, "pippo")
    of_node.add_port(45, "pluto")
    rspec.datapath(of_node)

    print rspec
    (result, error) = validate(rspec.get_rspec())
    if not result:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    print '=== OFv3RequestParser ==='
    rspec = OFv3AdvertisementParser("adv_rspec_example.xml")

    (result, error) = validate(rspec.get_rspec())
    if not result:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    nodes = rspec.nodes()
    print "Nodes(%d)=%s" % (len(nodes), nodes)

    ofnodes = rspec.ofnodes()
    print "OFNodes(%d)=%s" % (len(ofnodes), ofnodes)

    for ofn in ofnodes:
        ofnode = ofn.get("ofnode")
        print "DPID=%s" % ofnode.dpid
        print "PORTS=%s" % ofnode.ports

    print 'Bye Bye...'
    return True
Beispiel #3
0
def main(argv=None):
    if not argv:
        argv = sys.argv

    print 'Start the test environment'
    print '=== SERMv3RequestParser ==='
    rspec = SERMv3RequestParser("request_rspec_example.xml")

    (result, error) = validate(rspec.get_rspec())
    if not result:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    print 'Bye Bye...'
    return True
Beispiel #4
0
def main(argv=None):
    if not argv:
        argv = sys.argv

    print 'Start the test environment'
    print '=== TNRMv3RequestParser ==='
    rspec = TNRMv3RequestParser("request_rspec_example.xml")

    (result, error) = validate(rspec.get_rspec())
    if not result:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    print 'Bye Bye...'
    return True
Beispiel #5
0
def main(argv=None):
    if not argv:
        argv = sys.argv

    print 'Start the test environment'
    print '=== OFv3RequestFormatter ==='

    rspec = OFv3RequestFormatter()
    rspec.sliver(description="My GENI experiment",
                 ref="http://www.geni.net",
                 email="*****@*****.**")
    rspec.controller(url="tcp:myctrl.example.net:9933",
                     type=CONTROLLER_TYPE_PRIMARY)
    rspec.group(name="mygrp")

    # first datapath
    prefix = "urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+"
    dp = Datapath(prefix + "datapath:06:a4:00:12:e2:b8:a5:d0",
                  prefix + "authority+am",
                  "06:a4:00:12:e2:b8:a5:d0")
    dp.add_port(7, "GBE0/7")
    dp.add_port(20, "GBE0/20")
    rspec.datapath("mygrp", dp)

    # second datapath
    dp = Datapath(prefix + "datapath:06:af:00:24:a8:c4:b9:00",
                  prefix + "authority+am",
                  "06:af:00:24:a8:c4:b9:00")
    dp.add_port(50, "26")
    dp.add_port(71, "47")
    dp.add_port(65534)
    rspec.datapath("mygrp", dp)

    # first match
    m = Match()
    m.add_use_group("mygrp")
    m.add_use_group("pippuzzo")
    m.set_packet(dl_type="0x800", nw_src="10.1.1.0/24",
                 nw_proto="6, 17", tp_src="80")
    rspec.match(m)

    # second match
    m = Match()
    m.add_use_group("mygrp")
    m.add_datapath(dp)
    m.add_datapath(dp)
    m.set_packet(dl_type="0x800", nw_dst="10.1.1.0/24",
                 nw_proto="617", tp_dst="8080")
    rspec.match(m)

    print rspec
    (result_ok, error) = validate(rspec.get_rspec())
    if not result_ok:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    print '=== OFv3RequestParser ==='
    rspec = OFv3RequestParser("request_rspec_example.xml")

    (result_ok, error) = validate(rspec.get_rspec())
    if not result_ok:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    sliver = rspec.sliver()
    print "Sliver=%s" % sliver

    controllers = rspec.controllers()
    print "Controllers=%s" % controllers

    groups = rspec.groups()
    print "Groups=%s" % groups

    datapaths = rspec.datapaths(groups[0]["name"])
    print "Group=%s, Datapath=%s" % (groups[0]["name"], datapaths)

    matches = rspec.matches()
    print "Matches=%s" % matches

    print 'Bye Bye...'
    return True
Beispiel #6
0
def main(argv=None):
    if not argv:
        argv = sys.argv

    print 'Start the test environment'
    print '=== OFv3RequestFormatter ==='

    rspec = OFv3RequestFormatter()
    rspec.sliver(description="My GENI experiment",
                 ref="http://www.geni.net",
                 email="*****@*****.**")
    rspec.controller(url="tcp:myctrl.example.net:9933",
                     type=CONTROLLER_TYPE_PRIMARY)
    rspec.group(name="mygrp")

    # first datapath
    prefix = "urn:publicid:IDN+openflow:foam:uxmal.gpolab.bbn.com+"
    dp = Datapath(prefix + "datapath:06:a4:00:12:e2:b8:a5:d0",
                  prefix + "authority+am", "06:a4:00:12:e2:b8:a5:d0")
    dp.add_port(7, "GBE0/7")
    dp.add_port(20, "GBE0/20")
    rspec.datapath("mygrp", dp)

    # second datapath
    dp = Datapath(prefix + "datapath:06:af:00:24:a8:c4:b9:00",
                  prefix + "authority+am", "06:af:00:24:a8:c4:b9:00")
    dp.add_port(50, "26")
    dp.add_port(71, "47")
    dp.add_port(65534)
    rspec.datapath("mygrp", dp)

    # first match
    m = Match()
    m.add_use_group("mygrp")
    m.add_use_group("pippuzzo")
    m.set_packet(dl_type="0x800",
                 nw_src="10.1.1.0/24",
                 nw_proto="6, 17",
                 tp_src="80")
    rspec.match(m)

    # second match
    m = Match()
    m.add_use_group("mygrp")
    m.add_datapath(dp)
    m.add_datapath(dp)
    m.set_packet(dl_type="0x800",
                 nw_dst="10.1.1.0/24",
                 nw_proto="617",
                 tp_dst="8080")
    rspec.match(m)

    print rspec
    (result_ok, error) = validate(rspec.get_rspec())
    if not result_ok:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    print '=== OFv3RequestParser ==='
    rspec = OFv3RequestParser("request_rspec_example.xml")

    (result_ok, error) = validate(rspec.get_rspec())
    if not result_ok:
        print "Validation failure: %s" % error
    else:
        print "Validation success!"

    sliver = rspec.sliver()
    print "Sliver=%s" % sliver

    controllers = rspec.controllers()
    print "Controllers=%s" % controllers

    groups = rspec.groups()
    print "Groups=%s" % groups

    datapaths = rspec.datapaths(groups[0]["name"])
    print "Group=%s, Datapath=%s" % (groups[0]["name"], datapaths)

    matches = rspec.matches()
    print "Matches=%s" % matches

    print 'Bye Bye...'
    return True