parent
926d890fc5
commit
b8a61ebfc1
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (StuSystem)" project-jdk-type="Python SDK" />
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (NetworkAnalog)" project-jdk-type="Python SDK" />
|
||||
</project>
|
Binary file not shown.
@ -0,0 +1,63 @@
|
||||
class AllSimConnect():
|
||||
# todo: 连接类
|
||||
def __init__(self, nodex, nodex_ifs, nodey, nodey_ifs, config=None):
|
||||
"""
|
||||
连接对象
|
||||
:param nodex: 节点
|
||||
:param nodex_ifs: 节点接口
|
||||
:param nodey: 节点
|
||||
:param nodey_ifs: 节点接口
|
||||
"""
|
||||
self.ConfigCorrect = 0 if config is None else config
|
||||
self.NobjS = nodex
|
||||
self.NobjE = nodey
|
||||
self.IfsS = nodex_ifs
|
||||
self.IfsE = nodey_ifs
|
||||
|
||||
class SimHost():
|
||||
"""
|
||||
主机类
|
||||
"""
|
||||
def __init__(self, x=0, y=0, id=None, config=None, label=None):
|
||||
self.ObjID = id
|
||||
self.ObjType = 1
|
||||
self.ObjLabel = label
|
||||
self.interface = []
|
||||
self.connections = []
|
||||
|
||||
class SimRouter():
|
||||
"""
|
||||
路由类
|
||||
"""
|
||||
def __init__(self, x=0, y=0, id=None, config=None, label=None, *args):
|
||||
self.ObjID = id
|
||||
self.ObjType = 2
|
||||
self.ObjLabel = label
|
||||
self.router_table = {}
|
||||
|
||||
class SimSwitch():
|
||||
"""
|
||||
交换机类
|
||||
"""
|
||||
def __init__(self, x=0, y=0, id=None, config=None, label=None, *args):
|
||||
self.ObjID = id
|
||||
self.ObjType = 3
|
||||
self.ObjLabel = label
|
||||
self.mac_table = {}
|
||||
|
||||
class SimHub():
|
||||
"""
|
||||
集线器类
|
||||
"""
|
||||
def __init__(self, x=0, y=0, id=None, config=None, label=None, *args):
|
||||
self.ObjID = str() if id is None else id
|
||||
self.ObjType = 4
|
||||
self.ObjLabel = label
|
||||
|
||||
if __name__ == '__main__':
|
||||
AllSimObj = []
|
||||
host1 = SimHost()
|
||||
AllSimObj.append(host1)
|
||||
router = SimRouter()
|
||||
AllSimObj.append(router)
|
||||
connect = AllSimConnect(host1, 1, router, 1)
|
Loading…
Reference in new issue