test_class.declarator: nvpApi = mock(NiciraNvpApi.class)
test_class.original_string: NiciraNvpApi nvpApi = mock(NiciraNvpApi.class);
test_class.type: NiciraNvpApi
test_class.var_name: nvpApi
test_class.declarator: resource
test_class.original_string: NiciraNvpResource resource;
test_class.type: NiciraNvpResource
test_class.var_name: resource
test_class.declarator: parameters
test_class.original_string: Map<String, Object> parameters;
test_class.type: Map<String, Object>
test_class.var_name: parameters
test_class.declarator: retryUtility
test_class.modifier: private
test_class.original_string: private CommandRetryUtility retryUtility;
test_class.type: CommandRetryUtility
test_class.var_name: retryUtility
test_class.file: plugins/network-elements/nicira-nvp/src/test/java/com/cloud/network/resource/NiciraNvpResourceTest.java
test_class.identifier: NiciraNvpResourceTest
test_case.body: @Test
      public void testGeneratePortForwardingRulePair() {
          final NatRule[] rules = resource.generatePortForwardingRulePair("10.10.10.10", new int[] { 8080, 8080 }, "11.11.11.11", new int[] { 80, 80 }, "tcp");
          assertTrue("DestinationNatRule".equals(rules[0].getType()));
          assertTrue("SourceNatRule".equals(rules[1].getType()));
  
          final DestinationNatRule dnr = (DestinationNatRule) rules[0];
          assertTrue(dnr.getToDestinationIpAddress().equals("10.10.10.10"));
          assertTrue(dnr.getToDestinationPort() == 8080);
          assertTrue(dnr.getMatch().getDestinationIpAddresses().equals("11.11.11.11"));
          assertTrue(dnr.getMatch().getDestinationPort() == 80);
          assertTrue(dnr.getMatch().getEthertype().equals("IPv4") && dnr.getMatch().getProtocol() == 6);
  
          final SourceNatRule snr = (SourceNatRule) rules[1];
          assertTrue(snr.getToSourceIpAddressMin().equals("11.11.11.11") && snr.getToSourceIpAddressMax().equals("11.11.11.11"));
          assertTrue(snr.getToSourcePort() == 80);
          assertTrue(snr.getMatch().getSourceIpAddresses().equals("10.10.10.10"));
          assertTrue(snr.getMatch().getSourcePort() == 8080);
          assertTrue(snr.getMatch().getEthertype().equals("IPv4") && rules[1].getMatch().getProtocol() == 6);
      }
test_case.class_method_signature: NiciraNvpResourceTest.testGeneratePortForwardingRulePair()
test_case.full_signature: @Test public void testGeneratePortForwardingRulePair()
test_case.identifier: testGeneratePortForwardingRulePair
test_case.invocations: generatePortForwardingRulePair assertTrue equals getType assertTrue equals getType assertTrue equals getToDestinationIpAddress assertTrue getToDestinationPort assertTrue equals getDestinationIpAddresses getMatch assertTrue getDestinationPort getMatch assertTrue equals getEthertype getMatch getProtocol getMatch assertTrue equals getToSourceIpAddressMin equals getToSourceIpAddressMax assertTrue getToSourcePort assertTrue equals getSourceIpAddresses getMatch assertTrue getSourcePort getMatch assertTrue equals getEthertype getMatch getProtocol getMatch
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testGeneratePortForwardingRulePair()
focal_class.declarator: s_logger = LoggerFactory.getLogger(NiciraNvpResource.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger s_logger = LoggerFactory.getLogger(NiciraNvpResource.class);
focal_class.type: Logger
focal_class.var_name: s_logger
focal_class.declarator: NAME_MAX_LEN = 40
focal_class.modifier: public static final
focal_class.original_string: public static final int NAME_MAX_LEN = 40;
focal_class.type: int
focal_class.var_name: NAME_MAX_LEN
focal_class.declarator: NUM_RETRIES = 2
focal_class.modifier: public static final
focal_class.original_string: public static final int NUM_RETRIES = 2;
focal_class.type: int
focal_class.var_name: NUM_RETRIES
focal_class.declarator: MAX_REDIRECTS = 5
focal_class.modifier: private static final
focal_class.original_string: private static final int MAX_REDIRECTS = 5;
focal_class.type: int
focal_class.var_name: MAX_REDIRECTS
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: guid
focal_class.modifier: private
focal_class.original_string: private String guid;
focal_class.type: String
focal_class.var_name: guid
focal_class.declarator: zoneId
focal_class.modifier: private
focal_class.original_string: private String zoneId;
focal_class.type: String
focal_class.var_name: zoneId
focal_class.declarator: niciraNvpApi
focal_class.modifier: private
focal_class.original_string: private NiciraNvpApi niciraNvpApi;
focal_class.type: NiciraNvpApi
focal_class.var_name: niciraNvpApi
focal_class.declarator: niciraNvpUtilities
focal_class.modifier: private
focal_class.original_string: private NiciraNvpUtilities niciraNvpUtilities;
focal_class.type: NiciraNvpUtilities
focal_class.var_name: niciraNvpUtilities
focal_class.declarator: retryUtility
focal_class.modifier: private
focal_class.original_string: private CommandRetryUtility retryUtility;
focal_class.type: CommandRetryUtility
focal_class.var_name: retryUtility
focal_class.file: plugins/network-elements/nicira-nvp/src/main/java/com/cloud/network/resource/NiciraNvpResource.java
focal_class.identifier: NiciraNvpResource
focal_class.interfaces: implements ServerResource
focal_class.class_method_signature: NiciraNvpResource.createNiciraNvpApi(final String host, final String username, final String password)
focal_class.full_signature: protected NiciraNvpApi createNiciraNvpApi(final String host, final String username, final String password)
focal_class.identifier: createNiciraNvpApi
focal_class.modifiers: protected
focal_class.parameters: (final String host, final String username, final String password)
focal_class.return: NiciraNvpApi
focal_class.signature: NiciraNvpApi createNiciraNvpApi(final String host, final String username, final String password)
focal_class.class_method_signature: NiciraNvpResource.configure(final String ignoredName, final Map<String, Object> params)
focal_class.full_signature: @Override public boolean configure(final String ignoredName, final Map<String, Object> params)
focal_class.identifier: configure
focal_class.modifiers: @Override public
focal_class.parameters: (final String ignoredName, final Map<String, Object> params)
focal_class.return: boolean
focal_class.signature: boolean configure(final String ignoredName, final Map<String, Object> params)
focal_class.class_method_signature: NiciraNvpResource.getNiciraNvpApi()
focal_class.full_signature: public NiciraNvpApi getNiciraNvpApi()
focal_class.identifier: getNiciraNvpApi
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: NiciraNvpApi
focal_class.signature: NiciraNvpApi getNiciraNvpApi()
focal_class.class_method_signature: NiciraNvpResource.getNiciraNvpUtilities()
focal_class.full_signature: public NiciraNvpUtilities getNiciraNvpUtilities()
focal_class.identifier: getNiciraNvpUtilities
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: NiciraNvpUtilities
focal_class.signature: NiciraNvpUtilities getNiciraNvpUtilities()
focal_class.class_method_signature: NiciraNvpResource.getRetryUtility()
focal_class.full_signature: public CommandRetryUtility getRetryUtility()
focal_class.identifier: getRetryUtility
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: CommandRetryUtility
focal_class.signature: CommandRetryUtility getRetryUtility()
focal_class.class_method_signature: NiciraNvpResource.start()
focal_class.full_signature: @Override public boolean start()
focal_class.identifier: start
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean start()
focal_class.class_method_signature: NiciraNvpResource.stop()
focal_class.full_signature: @Override public boolean stop()
focal_class.identifier: stop
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean stop()
focal_class.class_method_signature: NiciraNvpResource.getName()
focal_class.full_signature: @Override public String getName()
focal_class.identifier: getName
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getName()
focal_class.class_method_signature: NiciraNvpResource.getType()
focal_class.full_signature: @Override public Type getType()
focal_class.identifier: getType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Type
focal_class.signature: Type getType()
focal_class.class_method_signature: NiciraNvpResource.initialize()
focal_class.full_signature: @Override public StartupCommand[] initialize()
focal_class.identifier: initialize
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: StartupCommand[]
focal_class.signature: StartupCommand[] initialize()
focal_class.class_method_signature: NiciraNvpResource.getCurrentStatus(final long id)
focal_class.full_signature: @Override public PingCommand getCurrentStatus(final long id)
focal_class.identifier: getCurrentStatus
focal_class.modifiers: @Override public
focal_class.parameters: (final long id)
focal_class.return: PingCommand
focal_class.signature: PingCommand getCurrentStatus(final long id)
focal_class.class_method_signature: NiciraNvpResource.getApiProviderMajorityVersion(ControlClusterStatus ccs)
focal_class.full_signature: private void getApiProviderMajorityVersion(ControlClusterStatus ccs)
focal_class.identifier: getApiProviderMajorityVersion
focal_class.modifiers: private
focal_class.parameters: (ControlClusterStatus ccs)
focal_class.return: void
focal_class.signature: void getApiProviderMajorityVersion(ControlClusterStatus ccs)
focal_class.class_method_signature: NiciraNvpResource.searchApiProvider(ClusterRoleConfig[] configuredRoles)
focal_class.full_signature: private String searchApiProvider(ClusterRoleConfig[] configuredRoles)
focal_class.identifier: searchApiProvider
focal_class.modifiers: private
focal_class.parameters: (ClusterRoleConfig[] configuredRoles)
focal_class.return: String
focal_class.signature: String searchApiProvider(ClusterRoleConfig[] configuredRoles)
focal_class.class_method_signature: NiciraNvpResource.executeRequest(final Command cmd)
focal_class.full_signature: @Override public Answer executeRequest(final Command cmd)
focal_class.identifier: executeRequest
focal_class.modifiers: @Override public
focal_class.parameters: (final Command cmd)
focal_class.return: Answer
focal_class.signature: Answer executeRequest(final Command cmd)
focal_class.class_method_signature: NiciraNvpResource.disconnected()
focal_class.full_signature: @Override public void disconnected()
focal_class.identifier: disconnected
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void disconnected()
focal_class.class_method_signature: NiciraNvpResource.getAgentControl()
focal_class.full_signature: @Override public IAgentControl getAgentControl()
focal_class.identifier: getAgentControl
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: IAgentControl
focal_class.signature: IAgentControl getAgentControl()
focal_class.class_method_signature: NiciraNvpResource.setAgentControl(final IAgentControl agentControl)
focal_class.full_signature: @Override public void setAgentControl(final IAgentControl agentControl)
focal_class.identifier: setAgentControl
focal_class.modifiers: @Override public
focal_class.parameters: (final IAgentControl agentControl)
focal_class.return: void
focal_class.signature: void setAgentControl(final IAgentControl agentControl)
focal_class.class_method_signature: NiciraNvpResource.natRuleToString(final NatRule rule)
focal_class.full_signature: public String natRuleToString(final NatRule rule)
focal_class.identifier: natRuleToString
focal_class.modifiers: public
focal_class.parameters: (final NatRule rule)
focal_class.return: String
focal_class.signature: String natRuleToString(final NatRule rule)
focal_class.class_method_signature: NiciraNvpResource.truncate(final String string, final int length)
focal_class.full_signature: public String truncate(final String string, final int length)
focal_class.identifier: truncate
focal_class.modifiers: public
focal_class.parameters: (final String string, final int length)
focal_class.return: String
focal_class.signature: String truncate(final String string, final int length)
focal_class.class_method_signature: NiciraNvpResource.generateStaticNatRulePair(final String insideIp, final String outsideIp)
focal_class.full_signature: public NatRule[] generateStaticNatRulePair(final String insideIp, final String outsideIp)
focal_class.identifier: generateStaticNatRulePair
focal_class.modifiers: public
focal_class.parameters: (final String insideIp, final String outsideIp)
focal_class.return: NatRule[]
focal_class.signature: NatRule[] generateStaticNatRulePair(final String insideIp, final String outsideIp)
focal_class.class_method_signature: NiciraNvpResource.generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                      final String protocol)
focal_class.full_signature: public NatRule[] generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                      final String protocol)
focal_class.identifier: generatePortForwardingRulePair
focal_class.modifiers: public
focal_class.parameters: (final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                      final String protocol)
focal_class.return: NatRule[]
focal_class.signature: NatRule[] generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                      final String protocol)
focal_class.class_method_signature: NiciraNvpResource.setName(final String name)
focal_class.full_signature: @Override public void setName(final String name)
focal_class.identifier: setName
focal_class.modifiers: @Override public
focal_class.parameters: (final String name)
focal_class.return: void
focal_class.signature: void setName(final String name)
focal_class.class_method_signature: NiciraNvpResource.setConfigParams(final Map<String, Object> params)
focal_class.full_signature: @Override public void setConfigParams(final Map<String, Object> params)
focal_class.identifier: setConfigParams
focal_class.modifiers: @Override public
focal_class.parameters: (final Map<String, Object> params)
focal_class.return: void
focal_class.signature: void setConfigParams(final Map<String, Object> params)
focal_class.class_method_signature: NiciraNvpResource.getConfigParams()
focal_class.full_signature: @Override public Map<String, Object> getConfigParams()
focal_class.identifier: getConfigParams
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> getConfigParams()
focal_class.class_method_signature: NiciraNvpResource.getRunLevel()
focal_class.full_signature: @Override public int getRunLevel()
focal_class.identifier: getRunLevel
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int getRunLevel()
focal_class.class_method_signature: NiciraNvpResource.setRunLevel(final int level)
focal_class.full_signature: @Override public void setRunLevel(final int level)
focal_class.identifier: setRunLevel
focal_class.modifiers: @Override public
focal_class.parameters: (final int level)
focal_class.return: void
focal_class.signature: void setRunLevel(final int level)
focal_method.body: public NatRule[] generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                      final String protocol) {
          // Start with a basic static nat rule, then add port and protocol details
          final NatRule[] rulepair = generateStaticNatRulePair(insideIp, outsideIp);
  
          ((DestinationNatRule) rulepair[0]).setToDestinationPort(insidePorts[0]);
          rulepair[0].getMatch().setDestinationPort(outsidePorts[0]);
          rulepair[0].setOrder(50);
          rulepair[0].getMatch().setEthertype("IPv4");
          if ("tcp".equals(protocol)) {
              rulepair[0].getMatch().setProtocol(6);
          } else if ("udp".equals(protocol)) {
              rulepair[0].getMatch().setProtocol(17);
          }
  
          ((SourceNatRule) rulepair[1]).setToSourcePort(outsidePorts[0]);
          rulepair[1].getMatch().setSourcePort(insidePorts[0]);
          rulepair[1].setOrder(50);
          rulepair[1].getMatch().setEthertype("IPv4");
          if ("tcp".equals(protocol)) {
              rulepair[1].getMatch().setProtocol(6);
          } else if ("udp".equals(protocol)) {
              rulepair[1].getMatch().setProtocol(17);
          }
  
          return rulepair;
  
      }
focal_method.class_method_signature: NiciraNvpResource.generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                      final String protocol)
focal_method.full_signature: public NatRule[] generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                      final String protocol)
focal_method.identifier: generatePortForwardingRulePair
focal_method.invocations: generateStaticNatRulePair setToDestinationPort setDestinationPort getMatch setOrder setEthertype getMatch equals setProtocol getMatch equals setProtocol getMatch setToSourcePort setSourcePort getMatch setOrder setEthertype getMatch equals setProtocol getMatch equals setProtocol getMatch
focal_method.modifiers: public
focal_method.parameters: (final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                      final String protocol)
focal_method.return: NatRule[]
focal_method.signature: NatRule[] generatePortForwardingRulePair(final String insideIp, final int[] insidePorts, final String outsideIp, final int[] outsidePorts,
                      final String protocol)