示例#1
0
def main():
    try:
        print("*** CONNECTING TO UNL")
        UNL.create_lab()
        print("*** BUILDING TOPOLOGY")
        UNL.build_topo(topology)
        print("*** NORMALIZING CONFIGURATION FILES")
        conf_files = ConfAnalyzer()
        conf_files.normalize(file_io.read_yaml(INTF_CONV_FILE))
        print("*** EXTRACTING IP")
        conf_files.extract_ip()
        print("*** STARTING ALL NODES")
        UNL.start()
        print("*** CONFIGURING NODES")
        UNL.configure_nodes(TMP_DIR)
        print("*** ALL NODES CONFIGURED")
    except Exception:
        UNL.destroy()
        raise
    return 0
示例#2
0
def main():
    try:
        print("*** CONNECTING TO UNL")
        UNL.create_lab()
        print("*** BUILDING TOPOLOGY")
        UNL.build_topo(topology)
        print("*** NORMALIZING CONFIGURATION FILES")
        conf_files = ConfAnalyzer()
        conf_files.normalize(file_io.read_yaml(INTF_CONV_FILE))
        print("*** EXTRACTING IP")
        conf_files.extract_ip()
        print("*** STARTING ALL NODES")
        UNL.start()
        print("*** CONFIGURING NODES")
        UNL.configure_nodes(TMP_DIR)
        print("*** ALL NODES CONFIGURED")
    except Exception:
        UNL.destroy()
        raise
    return 0
示例#3
0
#!/usr/bin/python
import sys
import tools.file_io as file_io
from tools.unetlab import UNetLab
from tools.globals import *

UNL = UNetLab(**file_io.read_yaml('{}/unetlab.yml'.format(NET_DIR)))


def main():
    try:
        UNL.destroy()
        print("*** LAB DESTROYED")
        for f in os.listdir(TMP_DIR):
            file_path = os.path.join(TMP_DIR, f)
            if os.path.isfile(file_path):
                os.unlink(file_path)
        print("*** TMP DIRECTORY CLEANED UP")
    except:
        print('*** Emulation Failed')
        raise
    return 0


if __name__ == '__main__':
    sys.exit(main())
示例#4
0
#!/usr/bin/python
import sys
import tools.file_io as file_io
from tools.unetlab import UNetLab
from tools.globals import *

UNL = UNetLab(**file_io.read_yaml('{}/unetlab.yml'.format(NET_DIR)))


def main():
    try:
        UNL.destroy()
        print("*** LAB DESTROYED")
        for f in os.listdir(TMP_DIR):
            if not f.startswith('.'):
                file_path = os.path.join(TMP_DIR, f)
                if os.path.isfile(file_path):
                    os.unlink(file_path)
        print("*** TMP DIRECTORY CLEANED UP")
    except:
        print ('*** Emulation Failed')
        raise
    return 0

if __name__ == '__main__':
    sys.exit(main())

示例#5
0
#!/usr/bin/python
import sys
from tools.globals import *
import tools.file_io as file_io
from tools.unetlab import UNetLab
from tools.conf_analyzer import ConfAnalyzer
from network import topology

UNL = UNetLab(**file_io.read_yaml('{}/unetlab.yml'.format(NET_DIR)))
INTF_CONV = file_io.read_yaml('{}/intf_conv.yml'.format(NET_DIR))


def main():
    try:
        conf_files = ConfAnalyzer()
        conf_files.normalize(INTF_CONV)
        print("*** CONFIG FILES NORMALIZED")
        conf_files.extract_ip()
        print("*** IPs EXTRACTED")
        UNL.create_lab()
        print("*** CONNECTED TO UNL")
        UNL.build_topo(topology)
        print("*** TOPOLOGY IS BUILT")
        UNL.start()
        print("*** NODES STARTED")
        UNL.configure_nodes(TMP_DIR)
        print("*** ALL NODES CONFIGURED")
    except Exception:
        UNL.destroy()
        raise
    return 0