def to_json(self): """Serialize to JSON dict""" return { '__type__': object_fullname(self), 'name': self.name, 'ips': [ip.toStr() for ip in self.ips], 'hw_addr': self.hw_addr.toStr()}
def to_json(self): """Serialize to JSON dict""" return {'__type__': object_fullname(self), 'start_node': get_json_attr(self.start_node), 'start_port': get_json_attr(self.start_port), 'end_node': get_json_attr(self.end_node), 'end_port': get_json_attr(self.end_port)}
def to_json(self): """Serialize to JSON dict""" return {'__type__': object_fullname(self), 'name': self.name, 'hid': self.hid, 'cmd': self.cmd, 'interfaces': [iface.to_json() for iface in self.interfaces]}
def to_json(self): """Serialize to JSON dict""" return {'__type__': object_fullname(self), 'node1': get_json_attr(self.node1), 'port1': get_json_attr(self.port1), 'node2': get_json_attr(self.node2), 'port2': get_json_attr(self.port2)}
def to_json(self): """Serialize to JSON dict""" return { '__type__': object_fullname(self), 'name': self.name, 'ips': [ip.toStr() for ip in self.ips], 'hw_addr': self.hw_addr.toStr() }
def to_json(self): """Serialize to JSON dict""" return { '__type__': object_fullname(self), 'name': self.name, 'hid': self.hid, 'interfaces': [iface.to_json() for iface in self.interfaces] }
def to_json(self): """Serialize to JSON dict""" return { '__type__': object_fullname(self), 'node1': get_json_attr(self.node1), 'port1': get_json_attr(self.port1), 'node2': get_json_attr(self.node2), 'port2': get_json_attr(self.port2) }
def to_json(self): """Serialize to JSON dict""" return { '__type__': object_fullname(self), 'start_node': get_json_attr(self.start_node), 'start_port': get_json_attr(self.start_port), 'end_node': get_json_attr(self.end_node), 'end_port': get_json_attr(self.end_port) }
def serialize_ofp_phy_port(port): """ Serializes OpenFlow physical port to JSON Dict """ attrs = ['port_no', 'hw_addr', 'name', 'config', 'state', 'curr', 'advertised', 'supported', 'peer'] json_dict = {'__type__': object_fullname(port)} print class_fullname(ofp_phy_port) for attr in attrs: value = getattr(port, attr, None) if hasattr(value, 'toStr'): value = value.toStr() json_dict[attr] = value return json_dict
def serialize_ofp_phy_port(port): """ Serializes OpenFlow physical port to JSON Dict """ attrs = [ 'port_no', 'hw_addr', 'name', 'config', 'state', 'curr', 'advertised', 'supported', 'peer' ] json_dict = {'__type__': object_fullname(port)} print class_fullname(ofp_phy_port) for attr in attrs: value = getattr(port, attr, None) if hasattr(value, 'toStr'): value = value.toStr() json_dict[attr] = value return json_dict