Example #1
0
def connectivity_request_from_json(json_request):
    json_obj = jsonpickle.decode(json_request)
    if 'driverRequest' not in json_obj:
        raise Exception('ConnectivityOperations', 'Deserialized request is None or empty')
    request = DriverRequest()
    request.actions = []
    for action in json_obj['driverRequest']['actions']:
        request.actions.append(ConnectivityActionRequest.from_dict(action))
    return request
def connectivity_request_from_json(json_request):
    json_obj = jsonpickle.decode(json_request)
    if 'driverRequest' not in json_obj:
        raise Exception('ConnectivityOperations', 'Deserialized request is None or empty')
    request = DriverRequest()
    request.actions = []
    for action in json_obj['driverRequest']['actions']:
        request.actions.append(ConnectivityActionRequest.from_dict(action))
    return request
 def _stub_remove_vlan_action(full_address='192.1.3.4/1', full_name='rest1/port1', vlan_id='200'):
     action = ConnectivityActionRequest()
     action.actionId = str(uuid.uuid4())
     action.type = ConnectivityActionRequest.REMOVE_VLAN
     action.actionTarget = ActionTarget(full_address=full_address,
                                        full_name=('%s' % full_name))
     action.connectionId = str(uuid.uuid4())
     action.connectionParams = ConnectionParams(mode='Access', vlan_id=vlan_id,
                                                vlan_service_attributes=[
                                                    AttributeNameValue(attribute_name='QNQ',
                                                                       attribute_value='false')
                                                ])
     action.connectorAttributes = []
     action.customActionAttributes = []
     return action
 def _stub_remove_vlan_action(full_address='192.1.3.4/1',
                              full_name='rest1/port1',
                              vlan_id='200'):
     action = ConnectivityActionRequest()
     action.actionId = str(uuid.uuid4())
     action.type = ConnectivityActionRequest.REMOVE_VLAN
     action.actionTarget = ActionTarget(full_address=full_address,
                                        full_name=('%s' % full_name))
     action.connectionId = str(uuid.uuid4())
     action.connectionParams = ConnectionParams(
         mode='Access',
         vlan_id=vlan_id,
         vlan_service_attributes=[
             AttributeNameValue(attribute_name='QNQ',
                                attribute_value='false')
         ])
     action.connectorAttributes = []
     action.customActionAttributes = []
     return action