forked from sdn-ixp/iSDX
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathxctrl.py
executable file
·61 lines (47 loc) · 1.72 KB
/
xctrl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
# Author:
# Rudiger Birkner (Networked Systems Group ETH Zurich)
import argparse
import os
import sys
np = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
if np not in sys.path:
sys.path.append(np)
import util.log
from client import RefMonClient # Socket
from gss import GSSmS, GSSmT, GSSoS
from lib import Config
from mds import MDSmS, MDSmT
def main():
parser = argparse.ArgumentParser()
parser.add_argument('config', help='path of config file')
args = parser.parse_args()
# locate config file
config_file = os.path.abspath(args.config)
# start central sdx controller
logger = util.log.getLogger('xctrl')
logger.info('init')
config = Config(config_file)
logger.info('REFMON client: ' + str(config.refmon["IP"]) + ' ' + str(config.refmon["Port"]))
client = RefMonClient(config.refmon["IP"], config.refmon["Port"], config.refmon["key"])
if config.isMDSMode():
if config.isMultiSwitchMode():
controller = MDSmS(client, config)
logger.info('mode MDSmS - OF v1.0')
elif config.isMultiTableMode():
controller = MDSmT(client, config)
logger.info('mode MDSmT - OF v1.3')
elif config.isSupersetsMode():
if config.isMultiSwitchMode():
controller = GSSmS(client, config)
logger.info('mode GSSmS - OF v1.3')
elif config.isMultiTableMode():
controller = GSSmT(client, config)
logger.info('mode GSSmT - OF v1.3')
elif config.isOneSwitchMode():
controller = GSSoS(client, config)
logger.info('mode GSSoS - OF v1.3')
logger.info('start')
controller.start()
if __name__ == '__main__':
main()