Search in sources :

Example 1 with StaticNatRules

use of com.cloud.legacymodel.network.rules.StaticNatRules 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(), getStringSrcPortRange(rule), rule.getDstIp());
        rules.add(staticNatRule);
    }
    final StaticNatRules staticNatRules = new StaticNatRules(rules);
    return generateConfigItems(staticNatRules);
}
Also used : StaticNatRuleTO(com.cloud.legacymodel.to.StaticNatRuleTO) SetStaticNatRulesCommand(com.cloud.legacymodel.communication.command.SetStaticNatRulesCommand) StaticNatRules(com.cloud.legacymodel.network.rules.StaticNatRules) StaticNatRule(com.cloud.legacymodel.network.rules.StaticNatRule) LinkedList(java.util.LinkedList)

Aggregations

SetStaticNatRulesCommand (com.cloud.legacymodel.communication.command.SetStaticNatRulesCommand)1 StaticNatRule (com.cloud.legacymodel.network.rules.StaticNatRule)1 StaticNatRules (com.cloud.legacymodel.network.rules.StaticNatRules)1 StaticNatRuleTO (com.cloud.legacymodel.to.StaticNatRuleTO)1 LinkedList (java.util.LinkedList)1