Compare commits
No commits in common. "581e59f0741677f852d9d42f19e06c053e3bdd77" and "7c397e4245096d57fca00c3d0df6c6d7eec35d10" have entirely different histories.
581e59f074
...
7c397e4245
@ -11,6 +11,14 @@ ndb = NDB()
|
|||||||
|
|
||||||
|
|
||||||
def network_config(ip, mask, gateway):
|
def network_config(ip, mask, gateway):
|
||||||
|
# ip = IPRoute()
|
||||||
|
# index = ip.link_lookup(ifname='em1')[0]
|
||||||
|
# ip.addr('add', index, address='192.168.0.1', mask=24)
|
||||||
|
# ip.close()
|
||||||
|
# ip = IPDB()
|
||||||
|
# with ip.interfaces.br0 as br0:
|
||||||
|
# em1.add_ip('{ip}/{mask}'.format(ip=ip, mask=mask))
|
||||||
|
# ip.release()
|
||||||
with ndb.interfaces['br0'] as br0:
|
with ndb.interfaces['br0'] as br0:
|
||||||
address = '{ip}/{mask}'.format(ip=ip, mask=mask)
|
address = '{ip}/{mask}'.format(ip=ip, mask=mask)
|
||||||
br0.add_ip(address).commit()
|
br0.add_ip(address).commit()
|
||||||
@ -19,11 +27,14 @@ def network_config(ip, mask, gateway):
|
|||||||
|
|
||||||
|
|
||||||
def TestApp(*args):
|
def TestApp(*args):
|
||||||
NetworkView = npyscreen.ActionForm(name = "SaaS",)
|
# These lines create the form and populate it with widgets.
|
||||||
ip = NetworkView.add(npyscreen.TitleText, name = "IP:",)
|
# A fairly complex screen in only 8 or so lines of code - a line for each control.
|
||||||
mask = NetworkView.add(npyscreen.TitleText, name = "Netmask:",)
|
NetworkView = npyscreen.ActionForm(name = "SaaS",)
|
||||||
gateway = NetworkView.add(npyscreen.TitleText, name = "Gateway:",)
|
ip = NetworkView.add(npyscreen.TitleText, name = "IP:",)
|
||||||
|
mask = NetworkView.add(npyscreen.TitleText, name = "Netmask:",)
|
||||||
|
gateway = NetworkView.add(npyscreen.TitleText, name = "Gateway:",)
|
||||||
|
|
||||||
|
# This lets the user interact with the Form.
|
||||||
NetworkView.edit()
|
NetworkView.edit()
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
|
|||||||
@ -1,2 +0,0 @@
|
|||||||
__author__ = 'RemiZOffAlex'
|
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
|
||||||
@ -1,17 +0,0 @@
|
|||||||
__author__ = 'RemiZOffAlex'
|
|
||||||
__email__ = 'remizoffalex@mail.ru'
|
|
||||||
|
|
||||||
import npyscreen
|
|
||||||
|
|
||||||
|
|
||||||
class NetworkView(npyscreen.ActionForm):
|
|
||||||
def create(self):
|
|
||||||
self.ip = self.add(npyscreen.TitleText, name = "IP:",)
|
|
||||||
self.mask = self.add(npyscreen.TitleText, name = "Netmask:",)
|
|
||||||
self.gateway = self.add(npyscreen.TitleText, name = "Gateway:",)
|
|
||||||
|
|
||||||
def on_cancel(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def on_ok(self):
|
|
||||||
pass
|
|
||||||
Loading…
Reference in New Issue
Block a user