test_class.declarator: _resource
test_class.original_string: VirtualRoutingResource _resource;
test_class.type: VirtualRoutingResource
test_class.var_name: _resource
test_class.declarator: _currentCmd
test_class.original_string: NetworkElementCommand _currentCmd;
test_class.type: NetworkElementCommand
test_class.var_name: _currentCmd
test_class.declarator: _count
test_class.original_string: int _count;
test_class.type: int
test_class.var_name: _count
test_class.declarator: _file
test_class.original_string: String _file;
test_class.type: String
test_class.var_name: _file
test_class.declarator: ROUTERIP = "169.254.3.4"
test_class.original_string: String ROUTERIP = "169.254.3.4";
test_class.type: String
test_class.var_name: ROUTERIP
test_class.declarator: ROUTERGUESTIP = "10.200.1.1"
test_class.original_string: String ROUTERGUESTIP = "10.200.1.1";
test_class.type: String
test_class.var_name: ROUTERGUESTIP
test_class.declarator: ROUTERNAME = "r-4-VM"
test_class.original_string: String ROUTERNAME = "r-4-VM";
test_class.type: String
test_class.var_name: ROUTERNAME
test_class.file: nucleo/src/test/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResourceTest.java
test_class.identifier: VirtualRoutingResourceTest
test_class.interfaces: implements VirtualRouterDeployer
test_case.body: @Test
      public void testNetworkACLCommand() {
          final SetNetworkACLCommand cmd = generateSetNetworkACLCommand();
          _count = 0;
  
          Answer answer = _resource.executeRequest(cmd);
          assertTrue(answer.getResult());
  
          cmd.setAccessDetail(NetworkElementCommand.VPC_PRIVATE_GATEWAY, String.valueOf(VpcGateway.Type.Private));
          answer = _resource.executeRequest(cmd);
          assertTrue(answer.getResult());
      }
test_case.class_method_signature: VirtualRoutingResourceTest.testNetworkACLCommand()
test_case.full_signature: @Test public void testNetworkACLCommand()
test_case.identifier: testNetworkACLCommand
test_case.invocations: generateSetNetworkACLCommand executeRequest assertTrue getResult setAccessDetail valueOf executeRequest assertTrue getResult
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testNetworkACLCommand()
focal_class.declarator: s_logger = LoggerFactory.getLogger(VirtualRoutingResource.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger s_logger = LoggerFactory.getLogger(VirtualRoutingResource.class);
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: _vrDeployer
focal_class.modifier: private
focal_class.original_string: private VirtualRouterDeployer _vrDeployer;
focal_class.type: VirtualRouterDeployer
focal_class.var_name: _vrDeployer
focal_class.declarator: _vrAggregateCommandsSet
focal_class.modifier: private
focal_class.original_string: private Map<String, Queue<NetworkElementCommand>> _vrAggregateCommandsSet;
focal_class.type: Map<String, Queue<NetworkElementCommand>>
focal_class.var_name: _vrAggregateCommandsSet
focal_class.declarator: _vrLockMap = new HashMap<String, Lock>()
focal_class.modifier: protected
focal_class.original_string: protected Map<String, Lock> _vrLockMap = new HashMap<String, Lock>();
focal_class.type: Map<String, Lock>
focal_class.var_name: _vrLockMap
focal_class.declarator: _name
focal_class.modifier: private
focal_class.original_string: private String _name;
focal_class.type: String
focal_class.var_name: _name
focal_class.declarator: _sleep
focal_class.modifier: private
focal_class.original_string: private int _sleep;
focal_class.type: int
focal_class.var_name: _sleep
focal_class.declarator: _retry
focal_class.modifier: private
focal_class.original_string: private int _retry;
focal_class.type: int
focal_class.var_name: _retry
focal_class.declarator: _port
focal_class.modifier: private
focal_class.original_string: private int _port;
focal_class.type: int
focal_class.var_name: _port
focal_class.declarator: _eachTimeout
focal_class.modifier: private
focal_class.original_string: private int _eachTimeout;
focal_class.type: int
focal_class.var_name: _eachTimeout
focal_class.declarator: _cfgVersion = "1.0"
focal_class.modifier: private
focal_class.original_string: private String _cfgVersion = "1.0";
focal_class.type: String
focal_class.var_name: _cfgVersion
focal_class.file: nucleo/src/main/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java
focal_class.identifier: VirtualRoutingResource
focal_class.class_method_signature: VirtualRoutingResource.VirtualRoutingResource(VirtualRouterDeployer deployer)
focal_class.full_signature: public  VirtualRoutingResource(VirtualRouterDeployer deployer)
focal_class.identifier: VirtualRoutingResource
focal_class.modifiers: public
focal_class.parameters: (VirtualRouterDeployer deployer)
focal_class.signature:  VirtualRoutingResource(VirtualRouterDeployer deployer)
focal_class.class_method_signature: VirtualRoutingResource.executeRequest(final NetworkElementCommand cmd)
focal_class.full_signature: public Answer executeRequest(final NetworkElementCommand cmd)
focal_class.identifier: executeRequest
focal_class.modifiers: public
focal_class.parameters: (final NetworkElementCommand cmd)
focal_class.return: Answer
focal_class.signature: Answer executeRequest(final NetworkElementCommand cmd)
focal_class.class_method_signature: VirtualRoutingResource.executeQueryCommand(NetworkElementCommand cmd)
focal_class.full_signature: private Answer executeQueryCommand(NetworkElementCommand cmd)
focal_class.identifier: executeQueryCommand
focal_class.modifiers: private
focal_class.parameters: (NetworkElementCommand cmd)
focal_class.return: Answer
focal_class.signature: Answer executeQueryCommand(NetworkElementCommand cmd)
focal_class.class_method_signature: VirtualRoutingResource.applyConfigToVR(String routerAccessIp, ConfigItem c)
focal_class.full_signature: private ExecutionResult applyConfigToVR(String routerAccessIp, ConfigItem c)
focal_class.identifier: applyConfigToVR
focal_class.modifiers: private
focal_class.parameters: (String routerAccessIp, ConfigItem c)
focal_class.return: ExecutionResult
focal_class.signature: ExecutionResult applyConfigToVR(String routerAccessIp, ConfigItem c)
focal_class.class_method_signature: VirtualRoutingResource.applyConfigToVR(String routerAccessIp, ConfigItem c, int timeout)
focal_class.full_signature: private ExecutionResult applyConfigToVR(String routerAccessIp, ConfigItem c, int timeout)
focal_class.identifier: applyConfigToVR
focal_class.modifiers: private
focal_class.parameters: (String routerAccessIp, ConfigItem c, int timeout)
focal_class.return: ExecutionResult
focal_class.signature: ExecutionResult applyConfigToVR(String routerAccessIp, ConfigItem c, int timeout)
focal_class.class_method_signature: VirtualRoutingResource.applyConfig(NetworkElementCommand cmd, List<ConfigItem> cfg)
focal_class.full_signature: private Answer applyConfig(NetworkElementCommand cmd, List<ConfigItem> cfg)
focal_class.identifier: applyConfig
focal_class.modifiers: private
focal_class.parameters: (NetworkElementCommand cmd, List<ConfigItem> cfg)
focal_class.return: Answer
focal_class.signature: Answer applyConfig(NetworkElementCommand cmd, List<ConfigItem> cfg)
focal_class.class_method_signature: VirtualRoutingResource.execute(CheckS2SVpnConnectionsCommand cmd)
focal_class.full_signature: private CheckS2SVpnConnectionsAnswer execute(CheckS2SVpnConnectionsCommand cmd)
focal_class.identifier: execute
focal_class.modifiers: private
focal_class.parameters: (CheckS2SVpnConnectionsCommand cmd)
focal_class.return: CheckS2SVpnConnectionsAnswer
focal_class.signature: CheckS2SVpnConnectionsAnswer execute(CheckS2SVpnConnectionsCommand cmd)
focal_class.class_method_signature: VirtualRoutingResource.execute(GetRouterAlertsCommand cmd)
focal_class.full_signature: private GetRouterAlertsAnswer execute(GetRouterAlertsCommand cmd)
focal_class.identifier: execute
focal_class.modifiers: private
focal_class.parameters: (GetRouterAlertsCommand cmd)
focal_class.return: GetRouterAlertsAnswer
focal_class.signature: GetRouterAlertsAnswer execute(GetRouterAlertsCommand cmd)
focal_class.class_method_signature: VirtualRoutingResource.execute(CheckRouterCommand cmd)
focal_class.full_signature: private Answer execute(CheckRouterCommand cmd)
focal_class.identifier: execute
focal_class.modifiers: private
focal_class.parameters: (CheckRouterCommand cmd)
focal_class.return: Answer
focal_class.signature: Answer execute(CheckRouterCommand cmd)
focal_class.class_method_signature: VirtualRoutingResource.execute(GetDomRVersionCmd cmd)
focal_class.full_signature: private Answer execute(GetDomRVersionCmd cmd)
focal_class.identifier: execute
focal_class.modifiers: private
focal_class.parameters: (GetDomRVersionCmd cmd)
focal_class.return: Answer
focal_class.signature: Answer execute(GetDomRVersionCmd cmd)
focal_class.class_method_signature: VirtualRoutingResource.configure(final String name, final Map<String, Object> params)
focal_class.full_signature: public boolean configure(final String name, final Map<String, Object> params)
focal_class.identifier: configure
focal_class.modifiers: public
focal_class.parameters: (final String name, final Map<String, Object> params)
focal_class.return: boolean
focal_class.signature: boolean configure(final String name, final Map<String, Object> params)
focal_class.class_method_signature: VirtualRoutingResource.connect(final String ipAddress)
focal_class.full_signature: public boolean connect(final String ipAddress)
focal_class.identifier: connect
focal_class.modifiers: public
focal_class.parameters: (final String ipAddress)
focal_class.return: boolean
focal_class.signature: boolean connect(final String ipAddress)
focal_class.class_method_signature: VirtualRoutingResource.connect(final String ipAddress, final int port)
focal_class.full_signature: public boolean connect(final String ipAddress, final int port)
focal_class.identifier: connect
focal_class.modifiers: public
focal_class.parameters: (final String ipAddress, final int port)
focal_class.return: boolean
focal_class.signature: boolean connect(final String ipAddress, final int port)
focal_class.class_method_signature: VirtualRoutingResource.connect(final String ipAddress, int retry, int sleep)
focal_class.full_signature: public boolean connect(final String ipAddress, int retry, int sleep)
focal_class.identifier: connect
focal_class.modifiers: public
focal_class.parameters: (final String ipAddress, int retry, int sleep)
focal_class.return: boolean
focal_class.signature: boolean connect(final String ipAddress, int retry, int sleep)
focal_class.class_method_signature: VirtualRoutingResource.generateCommandCfg(NetworkElementCommand cmd)
focal_class.full_signature: private List<ConfigItem> generateCommandCfg(NetworkElementCommand cmd)
focal_class.identifier: generateCommandCfg
focal_class.modifiers: private
focal_class.parameters: (NetworkElementCommand cmd)
focal_class.return: List<ConfigItem>
focal_class.signature: List<ConfigItem> generateCommandCfg(NetworkElementCommand cmd)
focal_class.class_method_signature: VirtualRoutingResource.execute(AggregationControlCommand cmd)
focal_class.full_signature: private Answer execute(AggregationControlCommand cmd)
focal_class.identifier: execute
focal_class.modifiers: private
focal_class.parameters: (AggregationControlCommand cmd)
focal_class.return: Answer
focal_class.signature: Answer execute(AggregationControlCommand cmd)
focal_method.body: public Answer executeRequest(final NetworkElementCommand cmd) {
          boolean aggregated = false;
          String routerName = cmd.getAccessDetail(NetworkElementCommand.ROUTER_NAME);
          Lock lock;
          if (_vrLockMap.containsKey(routerName)) {
              lock = _vrLockMap.get(routerName);
          } else {
              lock = new ReentrantLock();
              _vrLockMap.put(routerName, lock);
          }
          lock.lock();
  
          try {
              ExecutionResult rc = _vrDeployer.prepareCommand(cmd);
              if (!rc.isSuccess()) {
                  s_logger.error("Failed to prepare VR command due to " + rc.getDetails());
                  return new Answer(cmd, false, rc.getDetails());
              }
  
              assert cmd.getRouterAccessIp() != null : "Why there is no access IP for VR?";
  
              if (cmd.isQuery()) {
                  return executeQueryCommand(cmd);
              }
  
              if (cmd instanceof AggregationControlCommand) {
                  return execute((AggregationControlCommand)cmd);
              }
  
              if (_vrAggregateCommandsSet.containsKey(routerName)) {
                  _vrAggregateCommandsSet.get(routerName).add(cmd);
                  aggregated = true;
                  // Clean up would be done after command has been executed
                  //TODO: Deal with group answer as well
                  return new Answer(cmd);
              }
  
              List<ConfigItem> cfg = generateCommandCfg(cmd);
              if (cfg == null) {
                  return Answer.createUnsupportedCommandAnswer(cmd);
              }
  
              return applyConfig(cmd, cfg);
          } catch (final IllegalArgumentException e) {
              return new Answer(cmd, false, e.getMessage());
          } finally {
              lock.unlock();
              if (!aggregated) {
                  ExecutionResult rc = _vrDeployer.cleanupCommand(cmd);
                  if (!rc.isSuccess()) {
                      s_logger.error("Failed to cleanup VR command due to " + rc.getDetails());
                  }
              }
          }
      }
focal_method.class_method_signature: VirtualRoutingResource.executeRequest(final NetworkElementCommand cmd)
focal_method.full_signature: public Answer executeRequest(final NetworkElementCommand cmd)
focal_method.identifier: executeRequest
focal_method.invocations: getAccessDetail containsKey get put lock prepareCommand isSuccess error getDetails getDetails getRouterAccessIp isQuery executeQueryCommand execute containsKey add get generateCommandCfg createUnsupportedCommandAnswer applyConfig getMessage unlock cleanupCommand isSuccess error getDetails
focal_method.modifiers: public
focal_method.parameters: (final NetworkElementCommand cmd)
focal_method.return: Answer
focal_method.signature: Answer executeRequest(final NetworkElementCommand cmd)