2 * Copyright (c) 2015 Dell, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.ovsdb.openstack.netvirt.sfc;
11 import com.google.common.net.InetAddresses;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.PortNumber;
17 * Open Vswitch DB OpenFlow 1.3 Networking Provider for Netvirt SFC Utilities.
20 public class NshUtils {
21 private Ipv4Address nshTunIpDst;
22 private PortNumber nshTunUdpPort;
25 private long nshMetaC1;
26 private long nshMetaC2;
33 * {@link NshUtils} constructor.
34 * @param nshTunIpDst Tunnel Destination IP
35 * @param nshTunUdpPort Tunnel Transport Port
36 * @param nshNsp Service Path Id
37 * @param nshNsi Service Path Index
38 * @param nshMetaC1 End point ID
39 * @param nshMetaC2 Tunnel Id.
41 public NshUtils(Ipv4Address nshTunIpDst, PortNumber nshTunUdpPort,
42 long nshNsp, short nshNsi, long nshMetaC1,
45 this.nshTunIpDst = nshTunIpDst;
46 this.nshTunUdpPort = nshTunUdpPort;
49 this.nshMetaC1 = nshMetaC1;
50 this.nshMetaC2 = nshMetaC2;
54 * @return the nshTunIpDst
56 public Ipv4Address getNshTunIpDst() {
61 * @param nshTunIpDst the nshTunIpDst to set
63 public void setNshTunIpDst(Ipv4Address nshTunIpDst) {
64 this.nshTunIpDst = nshTunIpDst;
68 * @return the nshTunUdpPort
70 public PortNumber getNshTunUdpPort() {
75 * @param nshTunUdpPort the nshTunUdpPort to set
77 public void setNshTunUdpPort(PortNumber nshTunUdpPort) {
78 this.nshTunUdpPort = nshTunUdpPort;
84 public long getNshNsp() {
89 * @param nshNsp the nshNsp to set
91 public void setNshNsp(long nshNsp) {
98 public short getNshNsi() {
103 * @param nshNsi the nshNsi to set
105 public void setNshNsi(short nshNsi) {
106 this.nshNsi = nshNsi;
110 * @return the nshMetaC1
112 public long getNshMetaC1() {
117 * @param nshMetaC1 the nshMetaC1 to set
119 public void setNshMetaC1(long nshMetaC1) {
120 this.nshMetaC1 = nshMetaC1;
124 * @return the nshMetaC2
126 public long getNshMetaC2() {
131 * @param nshMetaC2 the nshMetaC2 to set
133 public void setNshMetaC2(long nshMetaC2) {
134 this.nshMetaC2 = nshMetaC2;
137 public static Long convertIpAddressToLong(Ipv4Address ipv4Address) {
138 return (InetAddresses.coerceToInteger(InetAddresses.forString(ipv4Address.getValue()))) & 0xFFFFFFFFL;
142 * @see java.lang.Object#toString()
145 public String toString() {
146 return "NshUtils [nshTunIpDst=" + nshTunIpDst + ", nshTunUdpPort=" + nshTunUdpPort + ", nshNsp=" + nshNsp
147 + ", nshNsi=" + nshNsi + ", nshMetaC1=" + nshMetaC1 + ", nshMetaC2=" + nshMetaC2 + "]";