Пример #1
0
 def init_libnetvirt(self, type, entity):
     '''
     
     Initialize libnetvirt driver according to type
     
     '''
     if type == libnetvirt.LIBNETVIRT_FORWARDING_L2:
         info = libnetvirt.libnetvirt_init(libnetvirt.DRIVER_OF_NOX)
         con = libnetvirt.libnetvirt_connect(info, 
                                   entity.ocni_libnetvirt_of_controller, 
                                   int(entity.ocni_libnetvirt_of_controller_port))
     
         if con < 0:
             logger.error('Error while connecting to libnetvirt driver at : ' + entity.ocni_libnetvirt_of_controller)
             return -1
         
     elif type == libnetvirt.LIBNETVIRT_FORWARDING_L3VPN:
         info = libnetvirt.libnetvirt_init(libnetvirt.DRIVER_MPLS)
    
     else:
         logger.error('Unknown type')
         return -1
     
     return info
Пример #2
0
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library.  If not, see <http://www.gnu.org/licenses/>.


import libnetvirt
info = libnetvirt.libnetvirt_init(libnetvirt.DRIVER_OF_NOX)
for num in range(1,10000):
	libnetvirt.libnetvirt_connect(info, "127.0.0.1",2000) 
fns_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
	<description xmlns=\"http://www.sail-project.eu/fns\">\
	<fns name=\"two-fns\" uuid=\"1\">\
		<endpoint uuid=\"3\"> <swId>3</swId> <port>2</port> </endpoint>\
		<endpoint uuid=\"2\"> <swId>2</swId><port>2</port> </endpoint>\
		<endpoint uuid=\"4\"> <swId>4</swId><port>1</port> </endpoint>\
	</fns>\
	</description>"
fns = libnetvirt.parse_fns_Mem(fns_xml,len(fns_xml))
#fns = libnetvirt.parse_fns("fns.xml")
libnetvirt.libnetvirt_create_fns(info,fns)

fns1 = libnetvirt.create_local_fns(20,2,"fns_api")
Пример #3
0
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library.  If not, see <http://www.gnu.org/licenses/>.


import libnetvirt
info = libnetvirt.libnetvirt_init(libnetvirt.DRIVER_MPLS)
for num in range(1,10000):
	libnetvirt.libnetvirt_connect(info, "127.0.0.1",2000) 
fns_xml ="<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
	<description xmlns=\"http://www.sail-project.eu/fns\">\
	<fns name=\"two-fns\" uuid=\"1\">\
		<endpoint uuid=\"3\"> <swId>3</swId> <port>2</port> </endpoint>\
		<endpoint uuid=\"2\"> <swId>2</swId><port>2</port> </endpoint>\
		<endpoint uuid=\"4\"> <swId>4</swId><port>1</port> </endpoint>\
	</fns>\
	</description>"
fns = libnetvirt.parse_fns_Mem(fns_xml,len(fns_xml))
#fns = libnetvirt.parse_fns("fns.xml")
libnetvirt.libnetvirt_create_fns(info,fns)

fns1 = libnetvirt.create_local_fns(20,2,"fns_api")
Пример #4
0
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this library.  If not, see <http://www.gnu.org/licenses/>.

import libnetvirt
info = libnetvirt.libnetvirt_init(libnetvirt.DRIVER_MPLS)
for num in range(1, 10000):
    libnetvirt.libnetvirt_connect(info, "127.0.0.1", 2000)
fns_xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
	<description xmlns=\"http://www.sail-project.eu/fns\">\
	<fns name=\"two-fns\" uuid=\"1\">\
		<endpoint uuid=\"3\"> <swId>3</swId> <port>2</port> </endpoint>\
		<endpoint uuid=\"2\"> <swId>2</swId><port>2</port> </endpoint>\
		<endpoint uuid=\"4\"> <swId>4</swId><port>1</port> </endpoint>\
	</fns>\
	</description>"

fns = libnetvirt.parse_fns_Mem(fns_xml, len(fns_xml))
#fns = libnetvirt.parse_fns("fns.xml")
libnetvirt.libnetvirt_create_fns(info, fns)