mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 11:48:03 +00:00
mcast updates
This commit is contained in:
102
py-json/realm.py
102
py-json/realm.py
@@ -493,24 +493,12 @@ class Realm(LFCliBase):
|
||||
|
||||
class MULTICASTProfile(LFCliBase):
|
||||
def __init__(self, lfclient_host, lfclient_port, local_realm,
|
||||
side_a_min_bps=None, side_b_min_bps=None,
|
||||
side_a_max_bps=0, side_b_max_bps=0,
|
||||
side_a_min_pdu=-1, side_b_min_pdu=-1,
|
||||
side_a_max_pdu=0, side_b_max_pdu=0,
|
||||
report_timer_=3000, name_prefix_="Unset", number_template_="00000", debug_=False):
|
||||
"""
|
||||
|
||||
:param lfclient_host:
|
||||
:param lfclient_port:
|
||||
:param local_realm:
|
||||
:param side_a_min_bps:
|
||||
:param side_b_min_bps:
|
||||
:param side_a_max_bps:
|
||||
:param side_b_max_bps:
|
||||
:param side_a_min_pdu:
|
||||
:param side_b_min_pdu:
|
||||
:param side_a_max_pdu:
|
||||
:param side_b_max_pdu:
|
||||
:param name_prefix: prefix string for connection
|
||||
:param number_template_: how many zeros wide we padd, possibly a starting integer with left padding
|
||||
:param debug_:
|
||||
@@ -519,14 +507,6 @@ class MULTICASTProfile(LFCliBase):
|
||||
self.lfclient_url = "http://%s:%s" % (lfclient_host, lfclient_port)
|
||||
self.debug = debug_
|
||||
self.local_realm = local_realm
|
||||
self.side_a_min_pdu = side_a_min_pdu
|
||||
self.side_b_min_pdu = side_b_min_pdu
|
||||
self.side_a_max_pdu = side_a_max_pdu
|
||||
self.side_b_max_pdu = side_b_max_pdu
|
||||
self.side_a_min_bps = side_a_min_bps
|
||||
self.side_b_min_bps = side_b_min_bps
|
||||
self.side_a_max_bps = side_a_max_bps
|
||||
self.side_b_max_bps = side_b_max_bps
|
||||
self.report_timer = report_timer_
|
||||
self.created_mc = {}
|
||||
self.name_prefix = name_prefix_
|
||||
@@ -538,7 +518,7 @@ class MULTICASTProfile(LFCliBase):
|
||||
def refresh_mc(self):
|
||||
pass
|
||||
|
||||
def start_mc_tx(self, side_b, suppress_related_commands=None, debug_ = False ):
|
||||
def start_mc_tx(self, side_tx, suppress_related_commands=None, debug_ = False ):
|
||||
if self.debug:
|
||||
debut_=True
|
||||
|
||||
@@ -555,17 +535,17 @@ class MULTICASTProfile(LFCliBase):
|
||||
self.local_realm.json_post(url, json_data)
|
||||
|
||||
|
||||
def start_mc_rx(self,side_a, suppress_related_commands=None, debug_ = False):
|
||||
def start_mc_rx(self,side_rx, suppress_related_commands=None, debug_ = False):
|
||||
if self.debug:
|
||||
debug_=True
|
||||
|
||||
for port_name in side_a:
|
||||
side_a_info = self.local_realm.name_to_eid(port_name)
|
||||
side_a_resource = side_a_info[2]
|
||||
side_a_name = "%s%s"%(self.name_prefix, side_a_info[2])
|
||||
for port_name in side_rx:
|
||||
side_rx_info = self.local_realm.name_to_eid(port_name)
|
||||
side_rx_resource = side_rx_info[2]
|
||||
side_rx_name = "%s%s"%(self.name_prefix, side_rx_info[2])
|
||||
|
||||
json_data = {
|
||||
"endp_name":side_a_resource
|
||||
"endp_name":side_rx_resource
|
||||
}
|
||||
url = "cli-json/start_endp"
|
||||
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||
@@ -578,24 +558,20 @@ class MULTICASTProfile(LFCliBase):
|
||||
def cleanup(self):
|
||||
pass
|
||||
|
||||
def create_mc_tx(self, side_b, suppress_related_commands=None, debug_ = False ):
|
||||
def create_mc_tx(self, side_tx, suppress_related_commands=None, debug_ = False ):
|
||||
if self.debug:
|
||||
debug_=True
|
||||
|
||||
json_data = []
|
||||
|
||||
# need to eventually us this
|
||||
#mc_tx_name = "%s%s" % (self.name_prefix, side_b)
|
||||
|
||||
# hard code for now
|
||||
# hard code for now
|
||||
endp_name = 'mcast-xmit-sta'
|
||||
# add end point
|
||||
#add_endp mcast-xmit-sta 1 1 eth1 mc_udp -1 NO 4000000 0 NO 1472 0 INCREASING NO 32 0 0
|
||||
#add_endp mcast-xmit-sta 1 1 side_tx mc_udp -1 NO 4000000 0 NO 1472 0 INCREASING NO 32 0 0
|
||||
json_data = {
|
||||
'alias':endp_name,
|
||||
'shelf':1,
|
||||
'resource':1,
|
||||
'port':side_b,
|
||||
'port':side_tx,
|
||||
'type':'mc_udp',
|
||||
'ip_port':-1,
|
||||
'is_rate_bursty':
|
||||
@@ -610,24 +586,10 @@ class MULTICASTProfile(LFCliBase):
|
||||
'send_bad_crc_per_million':0,
|
||||
'multi_conn':0
|
||||
}
|
||||
|
||||
|
||||
url = "/cli-json/add_endp"
|
||||
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||
|
||||
|
||||
#set_endp_addr mcast-xmit-sta '0c c4 7a e1 ff b1 ' AUTO 0 0
|
||||
json_data = {
|
||||
'name':endp_name,
|
||||
"mac":"xx:xx:xx:xx:*:xx", #'mac':'0c:c4:7a:e1:ff:b1'
|
||||
'ip':'AUTO',
|
||||
'min_port':0,
|
||||
'max_port':0
|
||||
}
|
||||
|
||||
url = "cli-json/set_endp_addr"
|
||||
#self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||
|
||||
#set_mc_endp mcast-xmit-sta 32 224.9.9.9 9999 No # critical
|
||||
json_data = {
|
||||
'name':endp_name,
|
||||
@@ -639,24 +601,21 @@ class MULTICASTProfile(LFCliBase):
|
||||
url = "cli-json/set_mc_endp"
|
||||
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||
|
||||
|
||||
|
||||
|
||||
def create_mc_rx(self,side_a, suppress_related_commands=None, debug_ = False):
|
||||
def create_mc_rx(self,side_rx, suppress_related_commands=None, debug_ = False):
|
||||
if self.debug:
|
||||
debug_=True
|
||||
|
||||
for port_name in side_a:
|
||||
side_a_info = self.local_realm.name_to_eid(port_name)
|
||||
side_a_shelf = side_a_info[1]
|
||||
side_a_resource = side_a_info[2]
|
||||
side_a_name = "%s%s"%(self.name_prefix, side_a_info[2])
|
||||
for port_name in side_rx:
|
||||
side_rx_info = self.local_realm.name_to_eid(port_name)
|
||||
side_rx_shelf = side_rx_info[1]
|
||||
side_rx_resource = side_rx_info[2]
|
||||
side_rx_name = "%s%s"%(self.name_prefix, side_rx_info[2])
|
||||
# add_endp mcast-rcv-sta-001 1 1 sta0002 mc_udp 9999 NO 0 0 NO 1472 0 INCREASING NO 32 0 0
|
||||
json_data = {
|
||||
'alias':side_a_resource,
|
||||
'shelf':side_a_shelf,
|
||||
'alias':side_rx_resource,
|
||||
'shelf':side_rx_shelf,
|
||||
'resource':1,
|
||||
'port':side_a_resource,
|
||||
'port':side_rx_resource,
|
||||
'type':'mc_udp',
|
||||
'ip_port':9999,
|
||||
'is_rate_bursty':
|
||||
@@ -675,21 +634,8 @@ class MULTICASTProfile(LFCliBase):
|
||||
url = "cli-json/add_endp"
|
||||
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||
|
||||
#set_endp_addr mcast-rcv-sta-001 '00 0e 8e 5b 9d 44 ' AUTO 9999 0
|
||||
#json_data = {
|
||||
# 'name':side_a_resource,
|
||||
# 'mac':'xx:xx:xx:xx:*:xx',
|
||||
# 'ip':'AUTO',
|
||||
# 'min_port':9999,
|
||||
# 'max_port':0
|
||||
# }
|
||||
#
|
||||
#url = "cli-json/set_endp_addr"
|
||||
#self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||
|
||||
# set_mc_endp mcast-rcv-sta-001 32 224.9.9.9 9999 Yes
|
||||
json_data = {
|
||||
'name':side_a_resource,
|
||||
'name':side_rx_resource,
|
||||
'ttl':32,
|
||||
'mcast_group':'224.9.9.9',
|
||||
'mcast_dest_port':9999,
|
||||
@@ -698,12 +644,6 @@ class MULTICASTProfile(LFCliBase):
|
||||
url = "cli-json/set_mc_endp"
|
||||
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||
|
||||
'''json_data = {
|
||||
"endp_name":side_a_resource
|
||||
}
|
||||
url = "cli-json/start_endp"
|
||||
self.local_realm.json_post(url, json_data, debug_=debug_, suppress_related_commands_=suppress_related_commands)
|
||||
'''
|
||||
|
||||
def to_string(self):
|
||||
pprint.pprint(self)
|
||||
|
||||
@@ -17,31 +17,13 @@ import realm
|
||||
import time
|
||||
import datetime
|
||||
|
||||
#The valid ways to have multiple TX would be if they were on different ports.
|
||||
# I don't think that we need to add that complexity for now.
|
||||
|
||||
#In fact, it occurs to me that a multicast TX profile might actually already
|
||||
# know the right amount of information from which to generate it's RX endpoints
|
||||
|
||||
#So if we create a TX endpoint, it has a multicast ip and port.
|
||||
# Those two pieces of information are also useful for creating RXes.
|
||||
# I suggest one profile class.
|
||||
|
||||
|
||||
#multicast_profile.createTx(port) and multicast_profile.createRX(port_list)
|
||||
|
||||
#the ports have no knowledge of the protocols they will interact with,
|
||||
#the ports are layer-1 devices with some layer2 and layer3 features (mac addresses, IP addresses)
|
||||
#so anything you can legally assign an IP to can take a Layer3 connection or better
|
||||
|
||||
|
||||
class L3VariableTimeLongevity(LFCliBase):
|
||||
def __init__(self, host, port, endp_type, is_multicast, side_b, radios, radio_name_list, number_of_stations_per_radio_list,
|
||||
ssid_list, ssid_password_list, security, station_lists, name_prefix, resource=1,
|
||||
side_a_min_rate=56000, side_a_max_rate=0,
|
||||
side_b_min_rate=56000, side_b_max_rate=0,
|
||||
number_template="00", test_duration="256s",
|
||||
_debug_on=True,
|
||||
_debug_on=False,
|
||||
_exit_on_error=False,
|
||||
_exit_on_fail=False):
|
||||
super().__init__(host, port, _debug=_debug_on, _halt_on_error=_exit_on_error, _exit_on_fail=_exit_on_fail)
|
||||
@@ -138,20 +120,20 @@ class L3VariableTimeLongevity(LFCliBase):
|
||||
temp_station_list = station_list.copy()
|
||||
temp_stations_list.append(temp_station_list)
|
||||
temp_stations_list.append(self.side_b)
|
||||
self.local_realm.wait_for_ip(self.resource, temp_station_list)
|
||||
if self.local_realm.wait_for_ip(self.resource, temp_station_list,timeout_sec=120):
|
||||
print("ip's aquired")
|
||||
else:
|
||||
print("print failed to get IP's")
|
||||
|
||||
|
||||
|
||||
temp_station_list = []
|
||||
if self.is_multicast:
|
||||
for station_list in self.station_lists:
|
||||
for station in range(len(station_list)):
|
||||
temp_station_list.append(str(self.resource) + "." + station_list[station])
|
||||
|
||||
# start recievers
|
||||
self.multicast_profile.start_mc_rx(side_a=temp_station_list)
|
||||
|
||||
# right now the multicast is hard coded, need to pass in station
|
||||
self.multicast_profile.start_mc_tx(side_b=self.side_b)
|
||||
self.multicast_profile.start_mc_rx(side_rx=temp_station_list)
|
||||
self.multicast_profile.start_mc_tx(side_tx=self.side_b)
|
||||
|
||||
else:
|
||||
self.cx_profile.start_cx()
|
||||
@@ -249,8 +231,6 @@ class L3VariableTimeLongevity(LFCliBase):
|
||||
url = "cli-json/add_br"
|
||||
self.json_post(url, data)
|
||||
|
||||
#refactor later
|
||||
|
||||
try:
|
||||
data = LFUtils.port_dhcp_up_request(resource, self.side_b)
|
||||
self.json_post("/cli-json/set_port", data)
|
||||
@@ -258,28 +238,23 @@ class L3VariableTimeLongevity(LFCliBase):
|
||||
print("LFUtils.port_dhcp_up_request didn't complete ")
|
||||
print("or the json_post failed either way {} did not set up dhcp so test may no pass ".format(self.side_b))
|
||||
|
||||
#exit(1)
|
||||
|
||||
resource = 1
|
||||
index = 0
|
||||
for station_profile in self.station_profiles:
|
||||
station_profile.use_security(station_profile.security, station_profile.ssid, station_profile.ssid_pass)
|
||||
station_profile.set_number_template(station_profile.number_template)
|
||||
print("Creating stations")
|
||||
#station_profile.set_command_flag("add_sta", "create_admin_down", 1)
|
||||
#station_profile.set_command_param("set_port", "report_timer", 1500)
|
||||
#station_profile.set_command_flag("set_port", "rpt_timer", 1)
|
||||
temp_station_list = []
|
||||
|
||||
index = 0
|
||||
for station_list in self.station_lists:
|
||||
for station in range(len(station_list)):
|
||||
temp_station_list.append(str(self.resource) + "." + station_list[station])
|
||||
station_profile.create(resource=1, radio=self.radio_list[index], sta_names_=station_list, debug=True )
|
||||
station_profile.create(resource=1, radio=self.radio_list[index], sta_names_=station_list, debug=False )
|
||||
index += 1
|
||||
if self.is_multicast:
|
||||
self.multicast_profile.create_mc_tx(self.side_b)
|
||||
self.multicast_profile.create_mc_rx(side_a=temp_station_list)
|
||||
self.multicast_profile.create_mc_rx(side_rx=temp_station_list)
|
||||
else:
|
||||
self.cx_profile.create(endp_type=self.endp_type, side_a=temp_station_list, side_b='1.'+self.side_b, sleep_time=.5)
|
||||
self._pass("PASS: Stations build finished")
|
||||
|
||||
Reference in New Issue
Block a user