Add initial support to load port map from olt configuration if present.
Run the test case under olt config environment as appropriate.
Change the subscriberTest to load and use olt configuration if present before
falling back to default configuration from the auto-generated subscriber port map.
diff --git a/src/test/setup/cord-test.sh b/src/test/setup/cord-test.sh
index 5448a35..f1a5004 100755
--- a/src/test/setup/cord-test.sh
+++ b/src/test/setup/cord-test.sh
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
function show_help {
- echo "Usage: ${0#*/} -h | this help -n <onos_ip> -r <radius_ip> -o <onos cnt image> -a < onos app file> -d <radius cnt image> -t <test type> -c | cleanup test containers -C <cleanup container list> -k | kill the test container -b <test cnt image> | build test container docker image"
+ echo "Usage: ${0#*/} -h | this help -n <onos_ip> -O | use olt config | -r <radius_ip> -o <onos cnt image> -a < onos app file> -d <radius cnt image> -t <test type> -c | cleanup test containers -C <cleanup container list> -k | kill the test container -b <test cnt image> | build test container docker image"
exit 1
}
@@ -39,13 +39,17 @@
cleanup_cnt_list=
app_version=1.0-SNAPSHOT
onos_app_file=$PWD/../apps/ciena-cordigmp-$app_version.oar
+olt_config=0
-while getopts "h?a:n:r:o:d:t:cC:kb:" opt; do
+while getopts "h?a:n:r:o:d:t:cC:kOb:" opt; do
case "$opt" in
h|\?)
show_help
exit 1
;;
+ O)
+ olt_config=1
+ ;;
t)
test_type=$OPTARG
;;
@@ -150,9 +154,17 @@
install_onos_app $onos_app_file
+if [ $olt_config -eq 1 ]; then
+ olt_conf_loc="$PWD/olt_config.json"
+ olt_conf_test_loc="/root/test"${olt_conf_loc#$HOME\/nose_exp}
+ olt_env="OLT_CONFIG=$olt_conf_test_loc"
+ echo -e "\nTest running on OLT switch with olt env ${olt_env}"
+else
+ olt_env="OLT_CONFIG="
+ echo -e "\nTest running on OVS"
+fi
echo "Starting test container $nose_cnt_image"
-
-test_cnt=`docker run -itd --privileged -v $HOME/nose_exp:/root/test -v /lib/modules:/lib/modules -e ONOS_CONTROLLER_IP=$onos_ip -e ONOS_AAA_IP=$radius_ip $nose_cnt_image /bin/bash`
+test_cnt=`docker run -itd --privileged -v $HOME/nose_exp:/root/test -v /lib/modules:/lib/modules -e ONOS_CONTROLLER_IP=$onos_ip -e ONOS_AAA_IP=$radius_ip -e ${olt_env} $nose_cnt_image /bin/bash`
echo "Setting up test container $test_cnt"
docker exec $test_cnt pip install monotonic
echo "Starting up the OVS switch on the test container $test_cnt"
diff --git a/src/test/setup/olt_config.json b/src/test/setup/olt_config.json
new file mode 100644
index 0000000..83e2b06
--- /dev/null
+++ b/src/test/setup/olt_config.json
@@ -0,0 +1,2 @@
+{ "olt" : false , "ports" : { "tx" : "veth2", "rx" : "veth0" } }
+
diff --git a/src/test/subscriber/generate_portmap.py b/src/test/subscriber/generate_portmap.py
index b399010..a4d8fb0 100644
--- a/src/test/subscriber/generate_portmap.py
+++ b/src/test/subscriber/generate_portmap.py
@@ -4,11 +4,10 @@
header = '''###This file is auto-generated. Do not EDIT###'''
def generate_port_map(num = 100):
print("g_subscriber_port_map = {}")
- print("g_subscriber_reverse_port_map = {}")
for i in xrange(1, num+1):
intf = 'veth' + str(2*i-2)
print("g_subscriber_port_map[%d]='%s'" %(i, intf))
- print("g_subscriber_reverse_port_map['%s']=%d" %(intf, i))
+ print("g_subscriber_port_map['%s']=%d" %(intf, i))
if __name__ == '__main__':
num = 100
diff --git a/src/test/subscriber/portmaps.py b/src/test/subscriber/portmaps.py
index 398d666..1e6f03c 100644
--- a/src/test/subscriber/portmaps.py
+++ b/src/test/subscriber/portmaps.py
@@ -1,203 +1,402 @@
###This file is auto-generated. Do not EDIT###
g_subscriber_port_map = {}
-g_subscriber_reverse_port_map = {}
g_subscriber_port_map[1]='veth0'
-g_subscriber_reverse_port_map['veth0']=1
+g_subscriber_port_map['veth0']=1
g_subscriber_port_map[2]='veth2'
-g_subscriber_reverse_port_map['veth2']=2
+g_subscriber_port_map['veth2']=2
g_subscriber_port_map[3]='veth4'
-g_subscriber_reverse_port_map['veth4']=3
+g_subscriber_port_map['veth4']=3
g_subscriber_port_map[4]='veth6'
-g_subscriber_reverse_port_map['veth6']=4
+g_subscriber_port_map['veth6']=4
g_subscriber_port_map[5]='veth8'
-g_subscriber_reverse_port_map['veth8']=5
+g_subscriber_port_map['veth8']=5
g_subscriber_port_map[6]='veth10'
-g_subscriber_reverse_port_map['veth10']=6
+g_subscriber_port_map['veth10']=6
g_subscriber_port_map[7]='veth12'
-g_subscriber_reverse_port_map['veth12']=7
+g_subscriber_port_map['veth12']=7
g_subscriber_port_map[8]='veth14'
-g_subscriber_reverse_port_map['veth14']=8
+g_subscriber_port_map['veth14']=8
g_subscriber_port_map[9]='veth16'
-g_subscriber_reverse_port_map['veth16']=9
+g_subscriber_port_map['veth16']=9
g_subscriber_port_map[10]='veth18'
-g_subscriber_reverse_port_map['veth18']=10
+g_subscriber_port_map['veth18']=10
g_subscriber_port_map[11]='veth20'
-g_subscriber_reverse_port_map['veth20']=11
+g_subscriber_port_map['veth20']=11
g_subscriber_port_map[12]='veth22'
-g_subscriber_reverse_port_map['veth22']=12
+g_subscriber_port_map['veth22']=12
g_subscriber_port_map[13]='veth24'
-g_subscriber_reverse_port_map['veth24']=13
+g_subscriber_port_map['veth24']=13
g_subscriber_port_map[14]='veth26'
-g_subscriber_reverse_port_map['veth26']=14
+g_subscriber_port_map['veth26']=14
g_subscriber_port_map[15]='veth28'
-g_subscriber_reverse_port_map['veth28']=15
+g_subscriber_port_map['veth28']=15
g_subscriber_port_map[16]='veth30'
-g_subscriber_reverse_port_map['veth30']=16
+g_subscriber_port_map['veth30']=16
g_subscriber_port_map[17]='veth32'
-g_subscriber_reverse_port_map['veth32']=17
+g_subscriber_port_map['veth32']=17
g_subscriber_port_map[18]='veth34'
-g_subscriber_reverse_port_map['veth34']=18
+g_subscriber_port_map['veth34']=18
g_subscriber_port_map[19]='veth36'
-g_subscriber_reverse_port_map['veth36']=19
+g_subscriber_port_map['veth36']=19
g_subscriber_port_map[20]='veth38'
-g_subscriber_reverse_port_map['veth38']=20
+g_subscriber_port_map['veth38']=20
g_subscriber_port_map[21]='veth40'
-g_subscriber_reverse_port_map['veth40']=21
+g_subscriber_port_map['veth40']=21
g_subscriber_port_map[22]='veth42'
-g_subscriber_reverse_port_map['veth42']=22
+g_subscriber_port_map['veth42']=22
g_subscriber_port_map[23]='veth44'
-g_subscriber_reverse_port_map['veth44']=23
+g_subscriber_port_map['veth44']=23
g_subscriber_port_map[24]='veth46'
-g_subscriber_reverse_port_map['veth46']=24
+g_subscriber_port_map['veth46']=24
g_subscriber_port_map[25]='veth48'
-g_subscriber_reverse_port_map['veth48']=25
+g_subscriber_port_map['veth48']=25
g_subscriber_port_map[26]='veth50'
-g_subscriber_reverse_port_map['veth50']=26
+g_subscriber_port_map['veth50']=26
g_subscriber_port_map[27]='veth52'
-g_subscriber_reverse_port_map['veth52']=27
+g_subscriber_port_map['veth52']=27
g_subscriber_port_map[28]='veth54'
-g_subscriber_reverse_port_map['veth54']=28
+g_subscriber_port_map['veth54']=28
g_subscriber_port_map[29]='veth56'
-g_subscriber_reverse_port_map['veth56']=29
+g_subscriber_port_map['veth56']=29
g_subscriber_port_map[30]='veth58'
-g_subscriber_reverse_port_map['veth58']=30
+g_subscriber_port_map['veth58']=30
g_subscriber_port_map[31]='veth60'
-g_subscriber_reverse_port_map['veth60']=31
+g_subscriber_port_map['veth60']=31
g_subscriber_port_map[32]='veth62'
-g_subscriber_reverse_port_map['veth62']=32
+g_subscriber_port_map['veth62']=32
g_subscriber_port_map[33]='veth64'
-g_subscriber_reverse_port_map['veth64']=33
+g_subscriber_port_map['veth64']=33
g_subscriber_port_map[34]='veth66'
-g_subscriber_reverse_port_map['veth66']=34
+g_subscriber_port_map['veth66']=34
g_subscriber_port_map[35]='veth68'
-g_subscriber_reverse_port_map['veth68']=35
+g_subscriber_port_map['veth68']=35
g_subscriber_port_map[36]='veth70'
-g_subscriber_reverse_port_map['veth70']=36
+g_subscriber_port_map['veth70']=36
g_subscriber_port_map[37]='veth72'
-g_subscriber_reverse_port_map['veth72']=37
+g_subscriber_port_map['veth72']=37
g_subscriber_port_map[38]='veth74'
-g_subscriber_reverse_port_map['veth74']=38
+g_subscriber_port_map['veth74']=38
g_subscriber_port_map[39]='veth76'
-g_subscriber_reverse_port_map['veth76']=39
+g_subscriber_port_map['veth76']=39
g_subscriber_port_map[40]='veth78'
-g_subscriber_reverse_port_map['veth78']=40
+g_subscriber_port_map['veth78']=40
g_subscriber_port_map[41]='veth80'
-g_subscriber_reverse_port_map['veth80']=41
+g_subscriber_port_map['veth80']=41
g_subscriber_port_map[42]='veth82'
-g_subscriber_reverse_port_map['veth82']=42
+g_subscriber_port_map['veth82']=42
g_subscriber_port_map[43]='veth84'
-g_subscriber_reverse_port_map['veth84']=43
+g_subscriber_port_map['veth84']=43
g_subscriber_port_map[44]='veth86'
-g_subscriber_reverse_port_map['veth86']=44
+g_subscriber_port_map['veth86']=44
g_subscriber_port_map[45]='veth88'
-g_subscriber_reverse_port_map['veth88']=45
+g_subscriber_port_map['veth88']=45
g_subscriber_port_map[46]='veth90'
-g_subscriber_reverse_port_map['veth90']=46
+g_subscriber_port_map['veth90']=46
g_subscriber_port_map[47]='veth92'
-g_subscriber_reverse_port_map['veth92']=47
+g_subscriber_port_map['veth92']=47
g_subscriber_port_map[48]='veth94'
-g_subscriber_reverse_port_map['veth94']=48
+g_subscriber_port_map['veth94']=48
g_subscriber_port_map[49]='veth96'
-g_subscriber_reverse_port_map['veth96']=49
+g_subscriber_port_map['veth96']=49
g_subscriber_port_map[50]='veth98'
-g_subscriber_reverse_port_map['veth98']=50
+g_subscriber_port_map['veth98']=50
g_subscriber_port_map[51]='veth100'
-g_subscriber_reverse_port_map['veth100']=51
+g_subscriber_port_map['veth100']=51
g_subscriber_port_map[52]='veth102'
-g_subscriber_reverse_port_map['veth102']=52
+g_subscriber_port_map['veth102']=52
g_subscriber_port_map[53]='veth104'
-g_subscriber_reverse_port_map['veth104']=53
+g_subscriber_port_map['veth104']=53
g_subscriber_port_map[54]='veth106'
-g_subscriber_reverse_port_map['veth106']=54
+g_subscriber_port_map['veth106']=54
g_subscriber_port_map[55]='veth108'
-g_subscriber_reverse_port_map['veth108']=55
+g_subscriber_port_map['veth108']=55
g_subscriber_port_map[56]='veth110'
-g_subscriber_reverse_port_map['veth110']=56
+g_subscriber_port_map['veth110']=56
g_subscriber_port_map[57]='veth112'
-g_subscriber_reverse_port_map['veth112']=57
+g_subscriber_port_map['veth112']=57
g_subscriber_port_map[58]='veth114'
-g_subscriber_reverse_port_map['veth114']=58
+g_subscriber_port_map['veth114']=58
g_subscriber_port_map[59]='veth116'
-g_subscriber_reverse_port_map['veth116']=59
+g_subscriber_port_map['veth116']=59
g_subscriber_port_map[60]='veth118'
-g_subscriber_reverse_port_map['veth118']=60
+g_subscriber_port_map['veth118']=60
g_subscriber_port_map[61]='veth120'
-g_subscriber_reverse_port_map['veth120']=61
+g_subscriber_port_map['veth120']=61
g_subscriber_port_map[62]='veth122'
-g_subscriber_reverse_port_map['veth122']=62
+g_subscriber_port_map['veth122']=62
g_subscriber_port_map[63]='veth124'
-g_subscriber_reverse_port_map['veth124']=63
+g_subscriber_port_map['veth124']=63
g_subscriber_port_map[64]='veth126'
-g_subscriber_reverse_port_map['veth126']=64
+g_subscriber_port_map['veth126']=64
g_subscriber_port_map[65]='veth128'
-g_subscriber_reverse_port_map['veth128']=65
+g_subscriber_port_map['veth128']=65
g_subscriber_port_map[66]='veth130'
-g_subscriber_reverse_port_map['veth130']=66
+g_subscriber_port_map['veth130']=66
g_subscriber_port_map[67]='veth132'
-g_subscriber_reverse_port_map['veth132']=67
+g_subscriber_port_map['veth132']=67
g_subscriber_port_map[68]='veth134'
-g_subscriber_reverse_port_map['veth134']=68
+g_subscriber_port_map['veth134']=68
g_subscriber_port_map[69]='veth136'
-g_subscriber_reverse_port_map['veth136']=69
+g_subscriber_port_map['veth136']=69
g_subscriber_port_map[70]='veth138'
-g_subscriber_reverse_port_map['veth138']=70
+g_subscriber_port_map['veth138']=70
g_subscriber_port_map[71]='veth140'
-g_subscriber_reverse_port_map['veth140']=71
+g_subscriber_port_map['veth140']=71
g_subscriber_port_map[72]='veth142'
-g_subscriber_reverse_port_map['veth142']=72
+g_subscriber_port_map['veth142']=72
g_subscriber_port_map[73]='veth144'
-g_subscriber_reverse_port_map['veth144']=73
+g_subscriber_port_map['veth144']=73
g_subscriber_port_map[74]='veth146'
-g_subscriber_reverse_port_map['veth146']=74
+g_subscriber_port_map['veth146']=74
g_subscriber_port_map[75]='veth148'
-g_subscriber_reverse_port_map['veth148']=75
+g_subscriber_port_map['veth148']=75
g_subscriber_port_map[76]='veth150'
-g_subscriber_reverse_port_map['veth150']=76
+g_subscriber_port_map['veth150']=76
g_subscriber_port_map[77]='veth152'
-g_subscriber_reverse_port_map['veth152']=77
+g_subscriber_port_map['veth152']=77
g_subscriber_port_map[78]='veth154'
-g_subscriber_reverse_port_map['veth154']=78
+g_subscriber_port_map['veth154']=78
g_subscriber_port_map[79]='veth156'
-g_subscriber_reverse_port_map['veth156']=79
+g_subscriber_port_map['veth156']=79
g_subscriber_port_map[80]='veth158'
-g_subscriber_reverse_port_map['veth158']=80
+g_subscriber_port_map['veth158']=80
g_subscriber_port_map[81]='veth160'
-g_subscriber_reverse_port_map['veth160']=81
+g_subscriber_port_map['veth160']=81
g_subscriber_port_map[82]='veth162'
-g_subscriber_reverse_port_map['veth162']=82
+g_subscriber_port_map['veth162']=82
g_subscriber_port_map[83]='veth164'
-g_subscriber_reverse_port_map['veth164']=83
+g_subscriber_port_map['veth164']=83
g_subscriber_port_map[84]='veth166'
-g_subscriber_reverse_port_map['veth166']=84
+g_subscriber_port_map['veth166']=84
g_subscriber_port_map[85]='veth168'
-g_subscriber_reverse_port_map['veth168']=85
+g_subscriber_port_map['veth168']=85
g_subscriber_port_map[86]='veth170'
-g_subscriber_reverse_port_map['veth170']=86
+g_subscriber_port_map['veth170']=86
g_subscriber_port_map[87]='veth172'
-g_subscriber_reverse_port_map['veth172']=87
+g_subscriber_port_map['veth172']=87
g_subscriber_port_map[88]='veth174'
-g_subscriber_reverse_port_map['veth174']=88
+g_subscriber_port_map['veth174']=88
g_subscriber_port_map[89]='veth176'
-g_subscriber_reverse_port_map['veth176']=89
+g_subscriber_port_map['veth176']=89
g_subscriber_port_map[90]='veth178'
-g_subscriber_reverse_port_map['veth178']=90
+g_subscriber_port_map['veth178']=90
g_subscriber_port_map[91]='veth180'
-g_subscriber_reverse_port_map['veth180']=91
+g_subscriber_port_map['veth180']=91
g_subscriber_port_map[92]='veth182'
-g_subscriber_reverse_port_map['veth182']=92
+g_subscriber_port_map['veth182']=92
g_subscriber_port_map[93]='veth184'
-g_subscriber_reverse_port_map['veth184']=93
+g_subscriber_port_map['veth184']=93
g_subscriber_port_map[94]='veth186'
-g_subscriber_reverse_port_map['veth186']=94
+g_subscriber_port_map['veth186']=94
g_subscriber_port_map[95]='veth188'
-g_subscriber_reverse_port_map['veth188']=95
+g_subscriber_port_map['veth188']=95
g_subscriber_port_map[96]='veth190'
-g_subscriber_reverse_port_map['veth190']=96
+g_subscriber_port_map['veth190']=96
g_subscriber_port_map[97]='veth192'
-g_subscriber_reverse_port_map['veth192']=97
+g_subscriber_port_map['veth192']=97
g_subscriber_port_map[98]='veth194'
-g_subscriber_reverse_port_map['veth194']=98
+g_subscriber_port_map['veth194']=98
g_subscriber_port_map[99]='veth196'
-g_subscriber_reverse_port_map['veth196']=99
+g_subscriber_port_map['veth196']=99
g_subscriber_port_map[100]='veth198'
-g_subscriber_reverse_port_map['veth198']=100
+g_subscriber_port_map['veth198']=100
+g_subscriber_port_map[101]='veth200'
+g_subscriber_port_map['veth200']=101
+g_subscriber_port_map[102]='veth202'
+g_subscriber_port_map['veth202']=102
+g_subscriber_port_map[103]='veth204'
+g_subscriber_port_map['veth204']=103
+g_subscriber_port_map[104]='veth206'
+g_subscriber_port_map['veth206']=104
+g_subscriber_port_map[105]='veth208'
+g_subscriber_port_map['veth208']=105
+g_subscriber_port_map[106]='veth210'
+g_subscriber_port_map['veth210']=106
+g_subscriber_port_map[107]='veth212'
+g_subscriber_port_map['veth212']=107
+g_subscriber_port_map[108]='veth214'
+g_subscriber_port_map['veth214']=108
+g_subscriber_port_map[109]='veth216'
+g_subscriber_port_map['veth216']=109
+g_subscriber_port_map[110]='veth218'
+g_subscriber_port_map['veth218']=110
+g_subscriber_port_map[111]='veth220'
+g_subscriber_port_map['veth220']=111
+g_subscriber_port_map[112]='veth222'
+g_subscriber_port_map['veth222']=112
+g_subscriber_port_map[113]='veth224'
+g_subscriber_port_map['veth224']=113
+g_subscriber_port_map[114]='veth226'
+g_subscriber_port_map['veth226']=114
+g_subscriber_port_map[115]='veth228'
+g_subscriber_port_map['veth228']=115
+g_subscriber_port_map[116]='veth230'
+g_subscriber_port_map['veth230']=116
+g_subscriber_port_map[117]='veth232'
+g_subscriber_port_map['veth232']=117
+g_subscriber_port_map[118]='veth234'
+g_subscriber_port_map['veth234']=118
+g_subscriber_port_map[119]='veth236'
+g_subscriber_port_map['veth236']=119
+g_subscriber_port_map[120]='veth238'
+g_subscriber_port_map['veth238']=120
+g_subscriber_port_map[121]='veth240'
+g_subscriber_port_map['veth240']=121
+g_subscriber_port_map[122]='veth242'
+g_subscriber_port_map['veth242']=122
+g_subscriber_port_map[123]='veth244'
+g_subscriber_port_map['veth244']=123
+g_subscriber_port_map[124]='veth246'
+g_subscriber_port_map['veth246']=124
+g_subscriber_port_map[125]='veth248'
+g_subscriber_port_map['veth248']=125
+g_subscriber_port_map[126]='veth250'
+g_subscriber_port_map['veth250']=126
+g_subscriber_port_map[127]='veth252'
+g_subscriber_port_map['veth252']=127
+g_subscriber_port_map[128]='veth254'
+g_subscriber_port_map['veth254']=128
+g_subscriber_port_map[129]='veth256'
+g_subscriber_port_map['veth256']=129
+g_subscriber_port_map[130]='veth258'
+g_subscriber_port_map['veth258']=130
+g_subscriber_port_map[131]='veth260'
+g_subscriber_port_map['veth260']=131
+g_subscriber_port_map[132]='veth262'
+g_subscriber_port_map['veth262']=132
+g_subscriber_port_map[133]='veth264'
+g_subscriber_port_map['veth264']=133
+g_subscriber_port_map[134]='veth266'
+g_subscriber_port_map['veth266']=134
+g_subscriber_port_map[135]='veth268'
+g_subscriber_port_map['veth268']=135
+g_subscriber_port_map[136]='veth270'
+g_subscriber_port_map['veth270']=136
+g_subscriber_port_map[137]='veth272'
+g_subscriber_port_map['veth272']=137
+g_subscriber_port_map[138]='veth274'
+g_subscriber_port_map['veth274']=138
+g_subscriber_port_map[139]='veth276'
+g_subscriber_port_map['veth276']=139
+g_subscriber_port_map[140]='veth278'
+g_subscriber_port_map['veth278']=140
+g_subscriber_port_map[141]='veth280'
+g_subscriber_port_map['veth280']=141
+g_subscriber_port_map[142]='veth282'
+g_subscriber_port_map['veth282']=142
+g_subscriber_port_map[143]='veth284'
+g_subscriber_port_map['veth284']=143
+g_subscriber_port_map[144]='veth286'
+g_subscriber_port_map['veth286']=144
+g_subscriber_port_map[145]='veth288'
+g_subscriber_port_map['veth288']=145
+g_subscriber_port_map[146]='veth290'
+g_subscriber_port_map['veth290']=146
+g_subscriber_port_map[147]='veth292'
+g_subscriber_port_map['veth292']=147
+g_subscriber_port_map[148]='veth294'
+g_subscriber_port_map['veth294']=148
+g_subscriber_port_map[149]='veth296'
+g_subscriber_port_map['veth296']=149
+g_subscriber_port_map[150]='veth298'
+g_subscriber_port_map['veth298']=150
+g_subscriber_port_map[151]='veth300'
+g_subscriber_port_map['veth300']=151
+g_subscriber_port_map[152]='veth302'
+g_subscriber_port_map['veth302']=152
+g_subscriber_port_map[153]='veth304'
+g_subscriber_port_map['veth304']=153
+g_subscriber_port_map[154]='veth306'
+g_subscriber_port_map['veth306']=154
+g_subscriber_port_map[155]='veth308'
+g_subscriber_port_map['veth308']=155
+g_subscriber_port_map[156]='veth310'
+g_subscriber_port_map['veth310']=156
+g_subscriber_port_map[157]='veth312'
+g_subscriber_port_map['veth312']=157
+g_subscriber_port_map[158]='veth314'
+g_subscriber_port_map['veth314']=158
+g_subscriber_port_map[159]='veth316'
+g_subscriber_port_map['veth316']=159
+g_subscriber_port_map[160]='veth318'
+g_subscriber_port_map['veth318']=160
+g_subscriber_port_map[161]='veth320'
+g_subscriber_port_map['veth320']=161
+g_subscriber_port_map[162]='veth322'
+g_subscriber_port_map['veth322']=162
+g_subscriber_port_map[163]='veth324'
+g_subscriber_port_map['veth324']=163
+g_subscriber_port_map[164]='veth326'
+g_subscriber_port_map['veth326']=164
+g_subscriber_port_map[165]='veth328'
+g_subscriber_port_map['veth328']=165
+g_subscriber_port_map[166]='veth330'
+g_subscriber_port_map['veth330']=166
+g_subscriber_port_map[167]='veth332'
+g_subscriber_port_map['veth332']=167
+g_subscriber_port_map[168]='veth334'
+g_subscriber_port_map['veth334']=168
+g_subscriber_port_map[169]='veth336'
+g_subscriber_port_map['veth336']=169
+g_subscriber_port_map[170]='veth338'
+g_subscriber_port_map['veth338']=170
+g_subscriber_port_map[171]='veth340'
+g_subscriber_port_map['veth340']=171
+g_subscriber_port_map[172]='veth342'
+g_subscriber_port_map['veth342']=172
+g_subscriber_port_map[173]='veth344'
+g_subscriber_port_map['veth344']=173
+g_subscriber_port_map[174]='veth346'
+g_subscriber_port_map['veth346']=174
+g_subscriber_port_map[175]='veth348'
+g_subscriber_port_map['veth348']=175
+g_subscriber_port_map[176]='veth350'
+g_subscriber_port_map['veth350']=176
+g_subscriber_port_map[177]='veth352'
+g_subscriber_port_map['veth352']=177
+g_subscriber_port_map[178]='veth354'
+g_subscriber_port_map['veth354']=178
+g_subscriber_port_map[179]='veth356'
+g_subscriber_port_map['veth356']=179
+g_subscriber_port_map[180]='veth358'
+g_subscriber_port_map['veth358']=180
+g_subscriber_port_map[181]='veth360'
+g_subscriber_port_map['veth360']=181
+g_subscriber_port_map[182]='veth362'
+g_subscriber_port_map['veth362']=182
+g_subscriber_port_map[183]='veth364'
+g_subscriber_port_map['veth364']=183
+g_subscriber_port_map[184]='veth366'
+g_subscriber_port_map['veth366']=184
+g_subscriber_port_map[185]='veth368'
+g_subscriber_port_map['veth368']=185
+g_subscriber_port_map[186]='veth370'
+g_subscriber_port_map['veth370']=186
+g_subscriber_port_map[187]='veth372'
+g_subscriber_port_map['veth372']=187
+g_subscriber_port_map[188]='veth374'
+g_subscriber_port_map['veth374']=188
+g_subscriber_port_map[189]='veth376'
+g_subscriber_port_map['veth376']=189
+g_subscriber_port_map[190]='veth378'
+g_subscriber_port_map['veth378']=190
+g_subscriber_port_map[191]='veth380'
+g_subscriber_port_map['veth380']=191
+g_subscriber_port_map[192]='veth382'
+g_subscriber_port_map['veth382']=192
+g_subscriber_port_map[193]='veth384'
+g_subscriber_port_map['veth384']=193
+g_subscriber_port_map[194]='veth386'
+g_subscriber_port_map['veth386']=194
+g_subscriber_port_map[195]='veth388'
+g_subscriber_port_map['veth388']=195
+g_subscriber_port_map[196]='veth390'
+g_subscriber_port_map['veth390']=196
+g_subscriber_port_map[197]='veth392'
+g_subscriber_port_map['veth392']=197
+g_subscriber_port_map[198]='veth394'
+g_subscriber_port_map['veth394']=198
+g_subscriber_port_map[199]='veth396'
+g_subscriber_port_map['veth396']=199
+g_subscriber_port_map[200]='veth398'
+g_subscriber_port_map['veth398']=200
diff --git a/src/test/subscriber/subscriberTest.py b/src/test/subscriber/subscriberTest.py
index d1807e5..598f609 100644
--- a/src/test/subscriber/subscriberTest.py
+++ b/src/test/subscriber/subscriberTest.py
@@ -16,24 +16,34 @@
from subscriberDb import SubscriberDB
from threadPool import ThreadPool
from portmaps import g_subscriber_port_map
-from portmaps import g_subscriber_reverse_port_map
+from OltConfig import *
log.setLevel('INFO')
class Subscriber(Channels):
-
+ PORT_TX_DEFAULT = 2
+ PORT_RX_DEFAULT = 1
+ INTF_TX_DEFAULT = 'veth2'
+ INTF_RX_DEFAULT = 'veth0'
STATS_RX = 0
STATS_TX = 1
STATS_JOIN = 2
STATS_LEAVE = 3
SUBSCRIBER_SERVICES = 'DHCP IGMP TLS'
- def __init__(self, name = 'sub', service = SUBSCRIBER_SERVICES, num = 1, channel_start = 0,
- tx_port = 2, rx_port = 1,
- iface = 'veth0', iface_mcast = 'veth2',
+ def __init__(self, name = 'sub', service = SUBSCRIBER_SERVICES, port_map = None,
+ num = 1, channel_start = 0,
+ tx_port = PORT_TX_DEFAULT, rx_port = PORT_RX_DEFAULT,
+ iface = INTF_RX_DEFAULT, iface_mcast = INTF_TX_DEFAULT,
mcast_cb = None, loginType = 'wireless'):
self.tx_port = tx_port
self.rx_port = rx_port
- self.tx_intf = g_subscriber_port_map[tx_port]
- self.rx_intf = g_subscriber_port_map[rx_port]
+ self.port_map = port_map or g_subscriber_port_map
+ try:
+ self.tx_intf = self.port_map[tx_port]
+ self.rx_intf = self.port_map[rx_port]
+ except:
+ self.tx_intf = self.port_map[PORT_TX_DEFAULT]
+ self.rx_intf = self.port_map[PORT_RX_DEFAULT]
+
Channels.__init__(self, num, channel_start = channel_start,
iface = self.rx_intf, iface_mcast = self.tx_intf, mcast_cb = mcast_cb)
self.name = name
@@ -149,7 +159,14 @@
aaa_loaded = False
def setUp(self):
- ''' Activate the dhcp and igmp apps'''
+ '''Load the OLT config and activate relevant apps'''
+ self.olt = OltConfig()
+ self.port_map = self.olt.olt_port_map()
+ ##if no olt config, fall back to ovs port map
+ if not self.port_map:
+ self.port_map = g_subscriber_port_map
+ else:
+ log.info('Using OLT Port configuration for test setup')
for app in self.apps:
onos_ctrl = OnosCtrl(app)
status, _ = onos_ctrl.activate()
@@ -304,6 +321,7 @@
for info in self.subscriber_info:
self.subscriber_list.append(Subscriber(name=info['Name'],
service=info['Service'],
+ port_map = self.port_map,
num=num_channels,
channel_start = channel_start,
tx_port = port_list[index][0],
@@ -328,7 +346,7 @@
channel_start = 0, cbs = None, port_list = []):
self.test_status = False
self.num_subscribers = num_subscribers
- self.subscriber_load(create = True, num = self.num_subscribers,
+ self.subscriber_load(create = True, num = num_subscribers,
num_channels = num_channels, channel_start = channel_start, port_list = port_list)
self.onos_aaa_load()
self.thread_pool = ThreadPool(min(100, self.num_subscribers), queue_size=1, wait_timeout=1)
diff --git a/src/test/utils/OltConfig.py b/src/test/utils/OltConfig.py
new file mode 100644
index 0000000..8fad75b
--- /dev/null
+++ b/src/test/utils/OltConfig.py
@@ -0,0 +1,32 @@
+import os
+import json
+##load the olt config
+
+class OltConfig:
+ def __init__(self, olt_conf_file = ''):
+ if not olt_conf_file:
+ self.olt_conf_file = os.getenv('OLT_CONFIG')
+ else:
+ self.olt_conf_file = olt_conf_file
+ try:
+ self.olt_handle = open(self.olt_conf_file, 'r')
+ self.olt_conf = json.load(self.olt_handle)
+ except:
+ self.olt_handle = None
+ self.olt_conf = {}
+ self.olt_conf['olt'] = False
+
+ def on_olt(self):
+ return self.olt_conf['olt'] is True
+
+ def olt_port_map(self):
+ if self.on_olt() and self.olt_conf.has_key('ports'):
+ port_map = {}
+ ##Build a rx/tx port number to interface map
+ port_map[1] = self.olt_conf['ports']['rx']
+ port_map[2] = self.olt_conf['ports']['tx']
+ port_map[port_map[1]] = 1
+ port_map[port_map[2]] = 2
+ return port_map
+ else:
+ return None