Exemplo n.º 1
0
 def do_info( self, line ):
     "Print short info about a VNF or all of them if none is specified."
     vnf_catalog = Catalog().get_db()
     for metadata in vnf_catalog.itervalues():
         try:
             if metadata['name'] == line.strip():
                 for k, v in metadata.iteritems():
                     output('%s: %s\n' % (k, v))
                 break
         except KeyError:
             pass
     else:
         for metadata in vnf_catalog.itervalues():
             try:
                 info = metadata.get('description', '').split('\n')[0]
                 output('%s: %s\n' % (metadata['name'], info))
             except KeyError:
                 pass
Exemplo n.º 2
0
    def start(self, nf_g, phy_g=None):
        """
        Create the service chain
            - Do the resource mapping process
            - Starts the virtual network element
            - Install the OF routes
        Return list of the newly initiated VNFs
        """
        # TODO: instead of phy_g, rely on NetworkManager, or simple_topology

        # Using NetworkManager to get physical topology if phy_g is not given explicitly
        if not phy_g:
            phy_g = self.network_manager.get_initial_topology()

        # dump(phy_g, 'NetMen converted topo')
        if nf_g.number_of_nodes() < 1 or phy_g.number_of_nodes(
        ) < 1 or not self.network_manager.network_alive():
            return []

        # Run the resource mapping algorithm
        vnf_to_host_list = Mapping.map(nf_g, phy_g, DefaultSorter)

        vnf_options = nf_g.node
        # Config vnf_manager
        vnf_manager = self.network_manager.vnf_manager
        vnf_manager.set_vnf_catalog(Catalog().get_db())
        # Start mapped VNFs on physical network element
        vnf_manager.start_vnfs(vnf_to_host_list, vnf_options)
        # Install routes
        # update states of VNFs run by netconf agents before route install
        # (to make phy_g consistent (containing remote VNFs as well))
        self.network_manager.scan_network(forced=True)

        # Error: If phy_g contains initial_topo from NetworkManager,
        # VNFs are always excluded and no routes will be installed!!
        self.rm.install_routes(nf_g, phy_g)

        return vnf_to_host_list
Exemplo n.º 3
0
 def __init__(self):
     self.catalog = Catalog()
Exemplo n.º 4
0
 def __init__ (self):
     self.vnf_type = None
     self._parse_args()
     self.catalog = Catalog()
     self.click_proc = None
     atexit.register(self.kill_click_proc)
Exemplo n.º 5
0
 def do_reload( self, line):
     "Reload VNF catalog"
     Catalog().load(line)
Exemplo n.º 6
0
 def complete_info( self, text, line, begidx, endidx):
     names = Catalog().get_db().keys()
     return [n for n in names if n.startswith(text)]
Exemplo n.º 7
0
def add_VNFs():
    """ add VNFs to catalog (required parameters should be given) """

    #1. First single Click elements are added to the DB
    Catalog().add_VNF(vnf_name='FromDevice',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='ToDevice',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='Queue',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='Tee',vnf_type='Click',hidden='True')
    #Catalog().add_VNF(vnf_name='Counter',vnf_type='Click',clickPath='/home/click',
    #			clickSource=['elements/standard/counter.cc','elements/standard/counter.cc'])
    Catalog().add_VNF(vnf_name='Counter',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='Classifier',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='IPClassifier',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='StripIPHeader',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='UnstripIPHeadet',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='Strip',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='Unstrip',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='ICMPPingSource',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='ARPQuerier',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='AggregateIPFlows',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='RFC2507Comp',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='RFC2507Decomp',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='IPAddRewriter',vnf_type='Click',hidden='True')

    Catalog().add_VNF(vnf_name='TCPOptimizer',vnf_type='Click',hidden='True')
    Catalog().add_VNF(vnf_name='MarkIPHeader',vnf_type='Click',hidden='True')

    Catalog().add_VNF(vnf_name='Print',vnf_type='Click',hidden='True')

    #2. Then the VNFs composed of several Click elements are added to the DB
    Catalog().add_VNF(vnf_name = 'simpleForwarder',
                      vnf_type = 'Click',
                      description = 'receive on the data interface and loop back the packet',
                      icon = 'forward.png')
    Catalog().add_VNF(vnf_name = 'simpleObservationPoint',
                      vnf_type = 'Click',
                      description = 'A simple observation point in click',
                      icon = 'search.png')
    Catalog().add_VNF(vnf_name = 'headerCompressor',
                      vnf_type = 'Click',
                      description = 'Compress IPv4/TCP headers as defined in RFC2507',
                      icon = 'decompress_small.png')
    Catalog().add_VNF(vnf_name = 'headerDecompressor',
                      vnf_type = 'Click',
                      description = 'Decompress IPv4/TCP headers as defined in RFC2507',
                      icon = 'compress2_small.png')
    Catalog().add_VNF(vnf_name = 'nat',
                      vnf_type = 'Click',
                      hidden = 'True',
                      description = 'Provide the functionality of basic network address translator')
    Catalog().add_VNF(vnf_name = 'tcpRWINOptimizer',
                      vnf_type = 'Click',
                      description = 'TCP Optimizer',
                      icon = 'forward.png')
    Catalog().add_VNF(vnf_name = 'testVNF',
                      vnf_type = 'Click',
                      description = 'A test VNF',
                      icon = 'forward.png')
    Catalog().add_VNF(vnf_name = 'RlncOnTheFlyEncoder',
                      vnf_type = 'Click',
                      description = 'Rlnc encoder with kodo.',
                      icon = 'forward.png')
    Catalog().add_VNF(vnf_name = 'RlncOnTheFlyDecoder',
                      vnf_type = 'Click',
                      description = 'Rlnc decoder with kodo',
                      icon = 'forward.png')
    print Catalog().get_db()
Exemplo n.º 8
0
def del_VNFs(vnf_list):
    for vnf in vnf_list:
        if Catalog().get_VNF(vnf_name = vnf) != []:
            Catalog().remove_VNF(vnf_name = vnf)