Rename __json__() to asdict()

This commit is contained in:
grossmj committed 2021-04-17 23:34:28 +09:30
1 parent 44074ff7c9
commit cefab8d362
89 files changed
+286 -282

No files matched your search

@@ -65,7 +65,7 @@ class NIOGenericEthernet(NIO):
return self._ethernet_device
def __json__(self):
def asdict(self):
return {
"type": "nio_generic_ethernet",
@@ -64,7 +64,7 @@ class NIOLinuxEthernet(NIO):
return self._ethernet_device
def __json__(self):
def asdict(self):
return {
"type": "nio_linux_ethernet",
+1 -1
View File
@@ -46,6 +46,6 @@ class NIONull(NIO):
await self._hypervisor.send(f"nio create_null {self._name}")
log.info(f"NIO NULL {self._name} created.")
def __json__(self):
def asdict(self):
return {"type": "nio_null"}
+1 -1
View File
@@ -58,7 +58,7 @@ class NIOTAP(NIO):
return self._tap_device
def __json__(self):
def asdict(self):
return {
"type": "nio_tap",
+1 -1
View File
@@ -126,7 +126,7 @@ class NIOUDP(NIO):
return self._rport
def __json__(self):
def asdict(self):
return {
"type": "nio_udp",
+1 -1
View File
@@ -79,7 +79,7 @@ class NIOUNIX(NIO):
return self._remote_file
def __json__(self):
def asdict(self):
return {
"type": "nio_unix",
+1 -1
View File
@@ -79,7 +79,7 @@ class NIOVDE(NIO):
return self._local_file
def __json__(self):
def asdict(self):
return {
"type": "nio_vde",
@@ -52,7 +52,7 @@ class ATMSwitch(Device):
if mappings:
self._mappings = mappings
def __json__(self):
def asdict(self):
mappings = {}
for source, destination in self._mappings.items():
+2 -2
View File
@@ -76,11 +76,11 @@ class C1700(Router):
self._clock_divisor = 8
self._sparsemem = False # never activate sparsemem for c1700 (unstable)
def __json__(self):
def asdict(self):
c1700_router_info = {"iomem": self._iomem, "chassis": self._chassis, "sparsemem": self._sparsemem}
router_info = Router.__json__(self)
router_info = Router.asdict(self)
router_info.update(c1700_router_info)
return router_info
+2 -2
View File
@@ -93,11 +93,11 @@ class C2600(Router):
self._clock_divisor = 8
self._sparsemem = False # never activate sparsemem for c2600 (unstable)
def __json__(self):
def asdict(self):
c2600_router_info = {"iomem": self._iomem, "chassis": self._chassis, "sparsemem": self._sparsemem}
router_info = Router.__json__(self)
router_info = Router.asdict(self)
router_info.update(c2600_router_info)
return router_info
+2 -2
View File
@@ -77,11 +77,11 @@ class C2691(Router):
if chassis is not None:
raise DynamipsError("c2691 routers do not have chassis")
def __json__(self):
def asdict(self):
c2691_router_info = {"iomem": self._iomem}
router_info = Router.__json__(self)
router_info = Router.asdict(self)
router_info.update(c2691_router_info)
return router_info
+2 -2
View File
@@ -73,11 +73,11 @@ class C3600(Router):
self._chassis = chassis
self._clock_divisor = 4
def __json__(self):
def asdict(self):
c3600_router_info = {"iomem": self._iomem, "chassis": self._chassis}
router_info = Router.__json__(self)
router_info = Router.asdict(self)
router_info.update(c3600_router_info)
return router_info
+2 -2
View File
@@ -77,11 +77,11 @@ class C3725(Router):
if chassis is not None:
raise DynamipsError("c3725 routers do not have chassis")
def __json__(self):
def asdict(self):
c3725_router_info = {"iomem": self._iomem}
router_info = Router.__json__(self)
router_info = Router.asdict(self)
router_info.update(c3725_router_info)
return router_info
+2 -2
View File
@@ -77,11 +77,11 @@ class C3745(Router):
if chassis is not None:
raise DynamipsError("c3745 routers do not have chassis")
def __json__(self):
def asdict(self):
c3745_router_info = {"iomem": self._iomem}
router_info = Router.__json__(self)
router_info = Router.asdict(self)
router_info.update(c3745_router_info)
return router_info
+2 -2
View File
@@ -92,7 +92,7 @@ class C7200(Router):
if chassis is not None:
raise DynamipsError("c7200 routers do not have chassis")
def __json__(self):
def asdict(self):
c7200_router_info = {
"npe": self._npe,
@@ -101,7 +101,7 @@ class C7200(Router):
"power_supplies": self._power_supplies,
}
router_info = Router.__json__(self)
router_info = Router.asdict(self)
router_info.update(c7200_router_info)
return router_info
@@ -53,7 +53,7 @@ class EthernetHub(Bridge):
else:
self._ports = ports
def __json__(self):
def asdict(self):
return {
"name": self.name,
@@ -109,7 +109,7 @@ class EthernetSwitch(Device):
else:
self._ports = ports
def __json__(self):
def asdict(self):
ethernet_switch_info = {
"name": self.name,
@@ -51,7 +51,7 @@ class FrameRelaySwitch(Device):
if mappings:
self._mappings = mappings
def __json__(self):
def asdict(self):
mappings = {}
for source, destination in self._mappings.items():
+1 -1
View File
@@ -155,7 +155,7 @@ class Router(BaseNode):
log.error(f"Can't move {path}: {str(e)}")
continue
def __json__(self):
def asdict(self):
router_info = {
"name": self.name,