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.server.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 sessions = monitoringService.getSessions();
27 schemas = monitoringService.getSchemas();
30 public NetconfState() {
34 @XmlElementWrapper(name = "schemas")
35 @XmlElement(name = "schema")
36 public Collection<MonitoringSchema> getSchemas() {
37 return Collections2.transform(schemas.nonnullSchema().values(), MonitoringSchema::new);
40 @XmlElementWrapper(name = "sessions")
41 @XmlElement(name = "session")
42 public Collection<MonitoringSession> getSessions() {
43 return Collections2.transform(sessions.nonnullSession().values(), MonitoringSession::new);