]> git.basschouten.com Git - openhab-addons.git/blob
707176168e48cb052afd0cd220aeeb62e0045427
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.mikrotik.internal.model;
14
15 import java.time.LocalDateTime;
16 import java.util.Map;
17
18 import org.eclipse.jdt.annotation.NonNullByDefault;
19 import org.eclipse.jdt.annotation.Nullable;
20 import org.openhab.binding.mikrotik.internal.util.Converter;
21
22 /**
23  * The {@link RouterosL2TPSrvInterface} is a model class for `l2tp-in` interface models having casting accessors for
24  * data that is specific to this network interface kind. Is a subclass of {@link RouterosInterfaceBase}.
25  *
26  * @author Oleg Vivtash - Initial contribution
27  */
28 @NonNullByDefault
29 public class RouterosL2TPSrvInterface extends RouterosInterfaceBase {
30     public RouterosL2TPSrvInterface(Map<String, String> props) {
31         super(props);
32     }
33
34     @Override
35     public RouterosInterfaceType getDesignedType() {
36         return RouterosInterfaceType.L2TP_SERVER;
37     }
38
39     @Override
40     public String getApiType() {
41         return "l2tp-server";
42     }
43
44     @Override
45     public boolean hasDetailedReport() {
46         return true;
47     }
48
49     @Override
50     public boolean hasMonitor() {
51         return false;
52     }
53
54     public @Nullable String getStatus() {
55         return getProp("status");
56     }
57
58     public @Nullable String getEncoding() {
59         return String.format("Encoding: %s", getProp("encoding", "None"));
60     }
61
62     public @Nullable String getClientAddress() {
63         return getProp("client-address");
64     }
65
66     public @Nullable String getUptime() {
67         return getProp("uptime");
68     }
69
70     public @Nullable LocalDateTime getUptimeStart() {
71         return Converter.routerosPeriodBack(getUptime());
72     }
73 }