2 * Copyright (c) 2013 Cisco Systems, 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
8 package org.opendaylight.netconf.test.tool.monitoring;
10 import com.google.common.collect.Collections2;
11 import java.util.Collection;
12 import javax.xml.bind.annotation.XmlElement;
13 import javax.xml.bind.annotation.XmlElementWrapper;
14 import javax.xml.bind.annotation.XmlRootElement;
15 import org.opendaylight.netconf.api.monitoring.NetconfMonitoringService;
16 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Schemas;
17 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.netconf.monitoring.rev101004.netconf.state.Sessions;
19 @XmlRootElement(name = MonitoringConstants.NETCONF_MONITORING_XML_ROOT_ELEMENT)
20 public final class NetconfState {
22 private Schemas schemas;
23 private Sessions sessions;
25 public NetconfState(final NetconfMonitoringService monitoringService) {
26 this.sessions = monitoringService.getSessions();
27 this.schemas = monitoringService.getSchemas();
30 public NetconfState() {}
32 @XmlElementWrapper(name = "schemas")
33 @XmlElement(name = "schema")
34 public Collection<MonitoringSchema> getSchemas() {
35 return Collections2.transform(schemas.getSchema(), MonitoringSchema::new);
38 @XmlElementWrapper(name = "sessions")
39 @XmlElement(name = "session")
40 public Collection<MonitoringSession> getSessions() {
41 return Collections2.transform(sessions.getSession(), MonitoringSession::new);