Exemplo n.º 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()}
Exemplo n.º 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)}
Exemplo n.º 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]}
Exemplo n.º 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)}
Exemplo n.º 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()
     }
Exemplo n.º 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]
     }
Exemplo n.º 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)
     }
Exemplo n.º 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)
     }
Exemplo n.º 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
Exemplo n.º 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