mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-11-02 03:37:55 +00:00
create_station_from_df: Fix whitespace
Signed-off-by: Matthew Stidham <stidmatt@gmail.com>
This commit is contained in:
@@ -13,7 +13,6 @@ if sys.version_info[0] != 3:
|
|||||||
print("This script requires Python 3")
|
print("This script requires Python 3")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
|
sys.path.append(os.path.join(os.path.abspath(__file__ + "../../../")))
|
||||||
|
|
||||||
lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base")
|
lfcli_base = importlib.import_module("py-json.LANforge.lfcli_base")
|
||||||
@@ -62,7 +61,6 @@ class CreateStation(Realm):
|
|||||||
pprint.pprint(self.sta_list)
|
pprint.pprint(self.sta_list)
|
||||||
print("---- ~Station List ----- ----- ----- ----- ----- ----- \n")
|
print("---- ~Station List ----- ----- ----- ----- ----- ----- \n")
|
||||||
|
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
# Build stations
|
# Build stations
|
||||||
self.station_profile.use_security(self.security, self.ssid, self.password)
|
self.station_profile.use_security(self.security, self.ssid, self.password)
|
||||||
@@ -80,8 +78,6 @@ class CreateStation(Realm):
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
required=[]
|
|
||||||
required.append({'name':'--df','help':'Which file you want to build stations off of?'})
|
|
||||||
parser = LFCliBase.create_basic_argparse(
|
parser = LFCliBase.create_basic_argparse(
|
||||||
prog='create_station_from_df.py',
|
prog='create_station_from_df.py',
|
||||||
formatter_class=argparse.RawTextHelpFormatter,
|
formatter_class=argparse.RawTextHelpFormatter,
|
||||||
@@ -99,29 +95,29 @@ def main():
|
|||||||
--ssid netgear
|
--ssid netgear
|
||||||
--passwd BLANK
|
--passwd BLANK
|
||||||
--debug
|
--debug
|
||||||
''',
|
''')
|
||||||
more_required=required)
|
required = parser.add_argument_group('required arguments')
|
||||||
|
required.add_argument('df', help='Which file do you want to build stations off of?', required=True)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
df=pd.read_csv(args.df)
|
df = pd.read_csv(args.df)
|
||||||
unique=df[['radio','ssid','passwd','security']].drop_duplicates().reset_index(drop=True)
|
unique = df[['radio', 'ssid', 'passwd', 'security']].drop_duplicates().reset_index(drop=True)
|
||||||
for item in unique.index:
|
for item in unique.index:
|
||||||
uniquedf=unique.iloc[item]
|
uniquedf = unique.iloc[item]
|
||||||
df1=df.merge(pd.DataFrame(uniquedf).transpose(),on=['radio','ssid','passwd','security'])
|
df1 = df.merge(pd.DataFrame(uniquedf).transpose(), on=['radio', 'ssid', 'passwd', 'security'])
|
||||||
try:
|
if uniquedf['radio']:
|
||||||
radio=uniquedf['radio']
|
radio = uniquedf['radio']
|
||||||
except:
|
else:
|
||||||
radio=args.radio
|
radio = args.radio
|
||||||
station_list=df1['station']
|
station_list = df1['station']
|
||||||
try:
|
if uniquedf['ssid']:
|
||||||
ssid=uniquedf['ssid']
|
ssid = uniquedf['ssid']
|
||||||
passwd=uniquedf['passwd']
|
passwd = uniquedf['passwd']
|
||||||
security=uniquedf['security']
|
security = uniquedf['security']
|
||||||
except:
|
else:
|
||||||
ssid=args.ssid
|
ssid = args.ssid
|
||||||
passwd=args.passwd
|
passwd = args.passwd
|
||||||
security=args.security
|
security = args.security
|
||||||
create_station = CreateStation(_host=args.mgr,
|
create_station = CreateStation(_host=args.mgr,
|
||||||
_port=args.mgr_port,
|
_port=args.mgr_port,
|
||||||
_ssid=ssid,
|
_ssid=ssid,
|
||||||
@@ -135,5 +131,6 @@ def main():
|
|||||||
create_station.build()
|
create_station.build()
|
||||||
print('Created %s stations' % len(unique.index))
|
print('Created %s stations' % len(unique.index))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|||||||
Reference in New Issue
Block a user