-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathpynetparse-remote.py
38 lines (32 loc) · 1.06 KB
/
pynetparse-remote.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
#!/usr/bin/env python
from netaddr import *
import os
import subprocess
#tool requires netaddr module
scope = raw_input("which scope do you want to expand? " )
pg = raw_input("which primary dhcp: ")
pgs = pg.replace("pdhcp", "sdhcp")
force = IPNetwork(scope)
all= list(force)
CNRUS = raw_input("CNR Username: ")
CNRPA = raw_input("CNR Password: ")
def dipps():
global ccm
global CNRUS
global CNRPA
for ccm in all:
# CNRUS = raw_input("CNR Username: ")
#CNRPA = raw_input("CNR Password: ")
ccm = str(ccm)
output= "nrcmd -C " + pg + " -N " + CNRUS + " -P " + CNRPA +" lease " + ccm + " force-available "
print "nrcmd -C " + pg + " lease " + ccm + " force-available "
subprocess.call(output, shell=True)
def dippss():
for ccm in all:
ccms = str(ccm)
output= "nrcmd -C " + pg + " -N " + CNRUS + " -P " + CNRPA +" lease " + ccms + " force-available "
print "nrcmd -C " + pgs + " lease " + ccms + " force-available "
subprocess.call(output, shell=True)
dipps()
print "\n"
dippss()