Merge "1. Corrected Ip Protocol match field. 2. Added mask for Ipv6 Extension header...
[controller.git] / opendaylight / netconf / netconf-monitoring / src / main / java / org / opendaylight / controller / netconf / monitoring / xml / model / MonitoringSession.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.controller.netconf.monitoring.xml.model;
9
10 import com.google.common.base.Preconditions;
11 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.NetconfSsh;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.sessions.Session;
13
14 import javax.xml.bind.annotation.XmlElement;
15 import javax.xml.bind.annotation.XmlTransient;
16
17 final class MonitoringSession {
18
19     @XmlTransient
20     private Session managementSession;
21
22     public MonitoringSession(Session managementSession) {
23         this.managementSession = managementSession;
24     }
25
26     public MonitoringSession() {
27     }
28
29     public void setManagementSession(Session managementSession) {
30         this.managementSession = managementSession;
31     }
32
33     @XmlElement(name = "session-id")
34     public long getId() {
35         return managementSession.getSessionId();
36     }
37
38     @XmlElement(name = "source-host")
39     public String getSourceHost() {
40         return managementSession.getSourceHost().getDomainName().getValue();
41     }
42
43     @XmlElement(name = "login-time")
44     public String getLoginTime() {
45         return managementSession.getLoginTime().getValue();
46     }
47
48     @XmlElement(name = "in-bad-rpcs")
49     public Long getInBadRpcs() {
50         return managementSession.getInBadRpcs().getValue();
51     }
52
53     @XmlElement(name = "in-rpcs")
54     public Long getInRpcs() {
55         return managementSession.getInRpcs().getValue();
56     }
57
58     @XmlElement(name = "out-notifications")
59     public Long getOutNotifications() {
60         return managementSession.getOutNotifications().getValue();
61     }
62
63     @XmlElement(name = "out-rpc-errors")
64     public Long getOutRpcErrors() {
65         return managementSession.getOutRpcErrors().getValue();
66     }
67
68     @XmlElement(name = "transport")
69     public String getTransport() {
70         Preconditions.checkState(managementSession.getTransport() == NetconfSsh.class);
71         return "netconf-ssh";
72     }
73
74     @XmlElement(name = "username")
75     public String getUsername() {
76         return managementSession.getUsername();
77     }
78 }