Search in sources :

Example 1 with FirewallRule

use of com.cloud.legacymodel.network.rules.FirewallRule in project cosmic by MissionCriticalCloud.

the class SetFirewallRulesConfigItem method generateConfig.

@Override
public List<ConfigItem> generateConfig(final NetworkElementCommand cmd) {
    final SetFirewallRulesCommand command = (SetFirewallRulesCommand) cmd;
    final List<FirewallRule> rules = new ArrayList<>();
    for (final FirewallRuleTO rule : command.getRules()) {
        final FirewallRule fwRule = new FirewallRule(rule.getId(), rule.getSrcVlanTag(), rule.getSrcIp(), rule.getProtocol(), rule.getSrcPortRange(), rule.revoked(), rule.isAlreadyAdded(), rule.getSourceCidrList(), rule.getPurpose().toString(), rule.getIcmpType(), rule.getIcmpCode(), rule.getTrafficType().toString(), rule.getGuestCidr(), rule.isDefaultEgressPolicy());
        rules.add(fwRule);
    }
    final FirewallRules ruleSet = new FirewallRules(rules.toArray(new FirewallRule[rules.size()]));
    return generateConfigItems(ruleSet);
}
Also used : ArrayList(java.util.ArrayList) FirewallRuleTO(com.cloud.legacymodel.to.FirewallRuleTO) SetFirewallRulesCommand(com.cloud.legacymodel.communication.command.SetFirewallRulesCommand) FirewallRule(com.cloud.legacymodel.network.rules.FirewallRule) FirewallRules(com.cloud.legacymodel.network.rules.FirewallRules)

Aggregations

SetFirewallRulesCommand (com.cloud.legacymodel.communication.command.SetFirewallRulesCommand)1 FirewallRule (com.cloud.legacymodel.network.rules.FirewallRule)1 FirewallRules (com.cloud.legacymodel.network.rules.FirewallRules)1 FirewallRuleTO (com.cloud.legacymodel.to.FirewallRuleTO)1 ArrayList (java.util.ArrayList)1