Search in sources :

Example 1 with StaticNatRule

use of com.cloud.agent.resource.virtualnetwork.model.StaticNatRule in project cloudstack by apache.

the class SetStaticNatRulesConfigItem method generateConfig.

@Override
public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
    final SetStaticNatRulesCommand command = (SetStaticNatRulesCommand) cmd;
    final LinkedList<StaticNatRule> rules = new LinkedList<>();
    for (final StaticNatRuleTO rule : command.getRules()) {
        final StaticNatRule staticNatRule = new StaticNatRule(rule.revoked(), rule.getProtocol(), rule.getSrcIp(), rule.getStringSrcPortRange(), rule.getDstIp());
        rules.add(staticNatRule);
    }
    final StaticNatRules staticNatRules = new StaticNatRules(rules);
    return generateConfigItems(staticNatRules);
}
Also used : StaticNatRuleTO(com.cloud.agent.api.to.StaticNatRuleTO) SetStaticNatRulesCommand(com.cloud.agent.api.routing.SetStaticNatRulesCommand) StaticNatRules(com.cloud.agent.resource.virtualnetwork.model.StaticNatRules) StaticNatRule(com.cloud.agent.resource.virtualnetwork.model.StaticNatRule) LinkedList(java.util.LinkedList)

Example 2 with StaticNatRule

use of com.cloud.agent.resource.virtualnetwork.model.StaticNatRule in project cosmic by MissionCriticalCloud.

the class SetStaticNatRulesConfigItem method generateConfig.

@Override
public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
    final SetStaticNatRulesCommand command = (SetStaticNatRulesCommand) cmd;
    final LinkedList<StaticNatRule> rules = new LinkedList<>();
    for (final StaticNatRuleTO rule : command.getRules()) {
        final StaticNatRule staticNatRule = new StaticNatRule(rule.revoked(), rule.getProtocol(), rule.getSrcIp(), rule.getStringSrcPortRange(), rule.getDstIp());
        rules.add(staticNatRule);
    }
    final StaticNatRules staticNatRules = new StaticNatRules(rules);
    return generateConfigItems(staticNatRules);
}
Also used : StaticNatRuleTO(com.cloud.agent.api.to.StaticNatRuleTO) SetStaticNatRulesCommand(com.cloud.agent.api.routing.SetStaticNatRulesCommand) StaticNatRules(com.cloud.agent.resource.virtualnetwork.model.StaticNatRules) StaticNatRule(com.cloud.agent.resource.virtualnetwork.model.StaticNatRule) LinkedList(java.util.LinkedList)

Aggregations

SetStaticNatRulesCommand (com.cloud.agent.api.routing.SetStaticNatRulesCommand)2 StaticNatRuleTO (com.cloud.agent.api.to.StaticNatRuleTO)2 StaticNatRule (com.cloud.agent.resource.virtualnetwork.model.StaticNatRule)2 StaticNatRules (com.cloud.agent.resource.virtualnetwork.model.StaticNatRules)2 LinkedList (java.util.LinkedList)2