def config_stp_mst(self, mstname, revision): payload = { "topSystem": { "children": [ { "stpEntity": { "children": [ { "stpInst": { "children": [ { "stpMstEntity": { "attributes": { "regName": mstname, "rev": revision } } } ] } } ] } } ] } } config = configbase(self.serial, payload) response = config.send() data = json.loads(response.text) return data
def config_trunk(self): payload = { "topSystem": { "children": [{ "interfaceEntity": { "children": [{ "l1PhysIf": { "attributes": { "id": self.id, "mode": self.mode, "trunkVlans": self.trunkVlans, "nativeVlan": self.nativeVlan } } }] } }] } } config = configbase(self.serial, payload) response = config.send() data = json.loads(response.text)['imdata'] if len(data) == 0: return True else: return False
def config_ipv4(self): config = configbase(self.serial, self.payload) response = config.send() data = json.loads(response.text)['imdata'] if data == []: return True else: return False
def config_staticroute1(self): payload = { "topSystem": { "children": [{ "ipv4Entity": { "children": [{ "ipv4Inst": { "children": [{ "ipv4Dom": { "attributes": { "name": "default" }, "children": [{ "ipv4Route": { "attributes": { "prefix": self.prefix }, "children": [{ "ipv4Nexthop": { "attributes": { "nhAddr": self.nhAddr, "nhIf": self.nhIf, "nhVrf": self.nhVrf, "object": self.object1, "pref": self.pref, "rtname": self.rtname, "tag": self.tag } } }] } }] } }] } }] } }] } } config = configbase(self.serial, payload) response = config.send() data = json.loads(response.text) if len(data) == 0: return True else: return False
def creat_ifvlan(self, fabEncap, name): payload = { "topSystem": { "children": [{ "bdEntity": { "children": [{ "l2BD": { "attributes": { "fabEncap": fabEncap, "name": name } } }] } }] } } config = configbase(self.serial, payload) response = config.send() data = json.loads(response.text)['imdata'] return True
def config_ifvlan(self): payload = { "topSystem": { "children": [{ "interfaceEntity": { "children": [{ "l1PhysIf": { "attributes": { "id": self.id, "mode": self.mode, "accessVlan": self.accessVlan } } }] } }] } } config = configbase(self.serial, payload) response = config.send() data = json.loads(response.text)['imdata'] return True
def config_stp_mst_priority(self, instanceid, priority): payload={ "topSystem": { "children": [ { "stpEntity": { "children": [ { "stpInst": { "children": [ { "stpMstEntity": { "children": [ { "stpMstDom": { "attributes": { "id": instanceid, "priority": priority } } } ] } } ] } } ] } } ] } } config = configbase(self.serial, payload) response = config.send() data = json.loads(response.text) return data
def config_stp_mode(self): payload = { "topSystem": { "children": [ { "stpEntity": { "children": [ { "stpInst": { "attributes": { "mode": self.mode } } } ] } } ] } } config = configbase(self.serial, payload) response = config.send() data = json.loads(response.text) return data
def config_stp_pvrst(self, adminSt="1", diameter="2", fwdTime="15", helloTime="2", vlanid="1", maxAge="20", priority="32768", rootMode="0", rootType="0" ): """ :param adminSt: :param diameter: :param fwdTime: :param helloTime: :param vlanid: :param maxAge: :param priority: :param rootMode: :param rootType: :return: https://pubhub.devnetcloud.com/media/nx-dme-ref-922/docs/Discovery%20Protocols/stp:Vlan/ """ payload = { "topSystem": { "children": [ { "stpEntity": { "children": [ { "stpInst": { "children": [ { "stpVlan": { "attributes": { "fwdTime": fwdTime, "helloTime": helloTime, "id": vlanid, "maxAge": maxAge, "priority": priority, "adminSt": adminSt, "diameter": diameter, "rootMode": rootMode, "rootType": rootType } } } ] } } ] } } ] } } config = configbase(self.serial, payload) response = config.send() data = json.loads(response.text) return data
def config_stp_mstentity(self, adminSt="1", fwdtime="15", helloTime="2", maxAge="20", maxHops="20", regName="", rev="0", simulate="1" ): """ :param adminSt: Admin State 1 - enabled 2 - disabled DEFAULT: enabled :param fwdtime:STP forward delay RANGE: [4 , 30] DEFAULT: 15 :param helloTime:STP Hello interval RANGE: [1 , 10] DEFAULT: 2 :param maxAge:STP max age interval RANGE: [6 , 40] DEFAULT: 20 :param maxHops:STP mst max hops RANGE: [1 , 255] DEFAULT: 20 :param regName:Region Name MAX SIZE: 32 DEFAULT:"" :param rev:Region Revision RANGE: [0 , 0xffff] DEFAULT: 0 :param simulate:spanning tree simulation 1 - enabled 2 - disabled DEFAULT: enabled :return: bool """ payload = { "topSystem": { "children": [ { "stpEntity": { "children": [ { "stpInst": { "attributes": { "mode": "mst" }, "children": [ { "stpMstEntity": { "attributes": { "adminSt": adminSt, "fwdTime": fwdtime, "helloTime": helloTime, "maxAge": maxAge, "maxHops": maxHops, "regName": regName, "rev": rev, "simulate": simulate, } } } ] } } ] } } ] } } config = configbase(self.serial, payload) response = config.send() data = json.loads(response.text) return data
def config_vtp_info(self): config = configbase(self.serial, self.payload) response = config.send() data = json.loads(response.text) return data