@Test public final void testGetProtocol_protoTcp() { SecurityRuleAttributes.Protocol protocolTcp = new SecurityRuleAttributes.Protocol(ProtocolTcp.class); secRuleBuilder.setProtocol(protocolTcp); Assert.assertEquals(IpProtoClassifierDefinition.TCP_VALUE, SecRuleEntityDecoder.getProtocol(secRuleBuilder.build())); }
public static Long getProtocol(SecurityRule secRule) { SecurityRuleAttributes.Protocol protocol = secRule.getProtocol(); if (protocol == null) { return null; } if (protocol.getUint8() != null) { return protocol.getUint8().longValue(); } if (protocol.getIdentityref() != null) { if (protocol.getIdentityref().equals(ProtocolTcp.class)) { return IpProtoClassifierDefinition.TCP_VALUE; } if (protocol.getIdentityref().equals(ProtocolUdp.class)) { return IpProtoClassifierDefinition.UDP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmp.class)) { return IpProtoClassifierDefinition.ICMP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmpV6.class)) { return IpProtoClassifierDefinition.ICMPv6_VALUE; } } throw new IllegalArgumentException("Neutron Security Rule Protocol value " + protocol + " is not supported."); }
SecRuleEntityDecoder { public static Long getProtocol(SecurityRule secRule) { SecurityRuleAttributes.Protocol protocol = secRule.getProtocol(); if (protocol == null) { return null; } if (protocol.getUint8() != null) { return protocol.getUint8().longValue(); } if (protocol.getIdentityref() != null) { if (protocol.getIdentityref().equals(ProtocolTcp.class)) { return IpProtoClassifierDefinition.TCP_VALUE; } if (protocol.getIdentityref().equals(ProtocolUdp.class)) { return IpProtoClassifierDefinition.UDP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmp.class)) { return IpProtoClassifierDefinition.ICMP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmpV6.class)) { return IpProtoClassifierDefinition.ICMPv6_VALUE; } } throw new IllegalArgumentException("Neutron Security Rule Protocol value " + protocol + " is not supported."); } }
SecRuleEntityDecoder { public static Long getProtocol(SecurityRule secRule) { SecurityRuleAttributes.Protocol protocol = secRule.getProtocol(); if (protocol == null) { return null; } if (protocol.getUint8() != null) { return protocol.getUint8().longValue(); } if (protocol.getIdentityref() != null) { if (protocol.getIdentityref().equals(ProtocolTcp.class)) { return IpProtoClassifierDefinition.TCP_VALUE; } if (protocol.getIdentityref().equals(ProtocolUdp.class)) { return IpProtoClassifierDefinition.UDP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmp.class)) { return IpProtoClassifierDefinition.ICMP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmpV6.class)) { return IpProtoClassifierDefinition.ICMPv6_VALUE; } } throw new IllegalArgumentException("Neutron Security Rule Protocol value " + protocol + " is not supported."); } private  SecRuleEntityDecoder(); }
SecRuleEntityDecoder { public static Long getProtocol(SecurityRule secRule) { SecurityRuleAttributes.Protocol protocol = secRule.getProtocol(); if (protocol == null) { return null; } if (protocol.getUint8() != null) { return protocol.getUint8().longValue(); } if (protocol.getIdentityref() != null) { if (protocol.getIdentityref().equals(ProtocolTcp.class)) { return IpProtoClassifierDefinition.TCP_VALUE; } if (protocol.getIdentityref().equals(ProtocolUdp.class)) { return IpProtoClassifierDefinition.UDP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmp.class)) { return IpProtoClassifierDefinition.ICMP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmpV6.class)) { return IpProtoClassifierDefinition.ICMPv6_VALUE; } } throw new IllegalArgumentException("Neutron Security Rule Protocol value " + protocol + " is not supported."); } private  SecRuleEntityDecoder(); static ContractId getContractId(SecurityRule secRule); static ClassifierInstance getClassifierInstance(SecurityRule secRule); static ActionRef createActionRefFromActionChoice(ActionChoice action); static ClassifierRef getClassifierRef(SecurityRule secRule); static Direction getDirection(SecurityRule secRule); static Clause getClause(SecurityRule secRule); static boolean isEtherTypeOfOneWithinTwo(SecurityRule one, SecurityRule two); static boolean isProtocolOfOneWithinTwo(SecurityRule one, SecurityRule two); static boolean isPortsOfOneWithinTwo(SecurityRule one, SecurityRule two); static Long getEtherType(SecurityRule secRule); static Long getProtocol(SecurityRule secRule); }
SecRuleEntityDecoder { public static Long getProtocol(SecurityRule secRule) { SecurityRuleAttributes.Protocol protocol = secRule.getProtocol(); if (protocol == null) { return null; } if (protocol.getUint8() != null) { return protocol.getUint8().longValue(); } if (protocol.getIdentityref() != null) { if (protocol.getIdentityref().equals(ProtocolTcp.class)) { return IpProtoClassifierDefinition.TCP_VALUE; } if (protocol.getIdentityref().equals(ProtocolUdp.class)) { return IpProtoClassifierDefinition.UDP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmp.class)) { return IpProtoClassifierDefinition.ICMP_VALUE; } if (protocol.getIdentityref().equals(ProtocolIcmpV6.class)) { return IpProtoClassifierDefinition.ICMPv6_VALUE; } } throw new IllegalArgumentException("Neutron Security Rule Protocol value " + protocol + " is not supported."); } private  SecRuleEntityDecoder(); static ContractId getContractId(SecurityRule secRule); static ClassifierInstance getClassifierInstance(SecurityRule secRule); static ActionRef createActionRefFromActionChoice(ActionChoice action); static ClassifierRef getClassifierRef(SecurityRule secRule); static Direction getDirection(SecurityRule secRule); static Clause getClause(SecurityRule secRule); static boolean isEtherTypeOfOneWithinTwo(SecurityRule one, SecurityRule two); static boolean isProtocolOfOneWithinTwo(SecurityRule one, SecurityRule two); static boolean isPortsOfOneWithinTwo(SecurityRule one, SecurityRule two); static Long getEtherType(SecurityRule secRule); static Long getProtocol(SecurityRule secRule);  }