Example #1
0
 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()}
Example #2
0
 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)}
Example #3
0
 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]}
Example #4
0
 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)}
Example #5
0
 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()
     }
Example #6
0
 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]
     }
Example #7
0
 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)
     }
Example #8
0
 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)
     }
Example #9
0
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
Example #10
0
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