Changed zeromq-routingtable module to remoterpc-routingtable based on codereview...
[controller.git] / opendaylight / md-sal / remoterpc-routingtable / integrationtest / test-nb / src / main / java / org / opendaylight / controller / tests / zmqroutingtable / rest / RouteIdentifierImpl.java
1 package org.opendaylight.controller.tests.zmqroutingtable.rest;
2
3 import org.opendaylight.controller.sal.connector.api.RpcRouter;
4 import org.opendaylight.yangtools.yang.common.QName;
5 import org.opendaylight.yangtools.yang.data.api.InstanceIdentifier;
6
7 import java.io.Serializable;
8 import java.net.URI;
9
10 /**
11  * @author: syedbahm
12  * Date: 12/10/13
13  */
14 public class RouteIdentifierImpl implements RpcRouter.RouteIdentifier, Serializable {
15
16     private final URI namespace;
17     private final QName QNAME;
18     private final QName instance;
19
20     public RouteIdentifierImpl() {
21         namespace = URI.create("http://cisco.com/example");
22         QNAME = new QName(namespace, "global");
23         instance = new QName(URI.create("127.0.0.1"), "local");
24     }
25
26     public RouteIdentifierImpl(String url,String instanceIP){
27         namespace = URI.create(url);
28         QNAME = new QName(namespace,"global");
29         instance =  new QName(URI.create(instanceIP), "local");
30     }
31
32
33     @Override
34     public QName getContext() {
35         return QNAME;
36     }
37
38     @Override
39     public QName getType() {
40         return QNAME;
41     }
42
43     @Override
44     public org.opendaylight.yangtools.yang.data.api.InstanceIdentifier getRoute() {
45         return InstanceIdentifier.of(instance);
46     }
47
48     @Override
49     public boolean equals(Object o) {
50         if (this == o) return true;
51         if (o == null || getClass() != o.getClass()) return false;
52
53         RouteIdentifierImpl that = (RouteIdentifierImpl) o;
54
55         if (!QNAME.equals(that.QNAME)) return false;
56         if (!instance.equals(that.instance)) return false;
57         if (!namespace.equals(that.namespace)) return false;
58
59         return true;
60     }
61
62     @Override
63     public int hashCode() {
64         int result = namespace.hashCode();
65         result = 31 * result + QNAME.hashCode();
66         result = 31 * result + instance.hashCode();
67         return result;
68     }
69 }