Switch to unified view

a b/src/networkSegmentation.py
1
""" 
2
Copyright (c) 2016, Jose Dolz .All rights reserved.
3
4
Redistribution and use in source and binary forms, with or without modification,
5
are permitted provided that the following conditions are met:
6
7
    1. Redistributions of source code must retain the above copyright notice,
8
       this list of conditions and the following disclaimer.
9
    2. Redistributions in binary form must reproduce the above copyright notice,
10
       this list of conditions and the following disclaimer in the documentation
11
       and/or other materials provided with the distribution.
12
13
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
14
    EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
15
    OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
16
    NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
17
    HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18
    WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19
    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
    OTHER DEALINGS IN THE SOFTWARE.
21
22
Jose Dolz. Dec, 2016.
23
email: jose.dolz.upv@gmail.com
24
LIVIA Department, ETS, Montreal.
25
"""
26
27
import sys
28
29
30
from LiviaNet.startTesting import startTesting
31
32
def printUsage(error_type):
33
    if error_type == 1:
34
        print(" ** ERROR!!: Few parameters used.")
35
    else:
36
        print(" ** ERROR!!: Asked to start with an already created network but its name is not specified.")
37
        
38
    print(" ******** USAGE ******** ")
39
    print(" --- argv 1: Name of the configIni file.")
40
    print(" --- argv 2: Network model name")
41
42
43
def networkSegmentation(argv):
44
    # Number of input arguments
45
    #    1: ConfigIniName (for segmentation)
46
    #    2: Network model name
47
   
48
    # Some sanity checks
49
    
50
    if len(argv) < 2:
51
        printUsage(1)
52
        sys.exit()
53
54
    configIniName = argv[0]
55
    networkModelName = argv[1]
56
    
57
    startTesting(networkModelName,configIniName)
58
    print(" ***************** SEGMENTATION DONE!!! ***************** ")
59
  
60
   
61
   
62
if __name__ == '__main__':
63
   networkSegmentation(sys.argv[1:])