blob: c094f7f83df6c817a016d2e2b13cfa77340ae118 [file] [log] [blame]
Daniele Moro94660a02019-12-02 12:02:07 -08001/*
2 * Copyright 2019-present Open Networking Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package org.opencord.bng.config;
18
19import org.onlab.packet.MacAddress;
20import org.onosproject.core.ApplicationId;
21import org.onosproject.net.ConnectPoint;
22import org.onosproject.net.config.Config;
23
24/**
25 * Configuration for the PPPoE control packet relay service.
26 */
27public class PppoeRelayConfig extends Config<ApplicationId> {
28 public static final String KEY = "pppoerelay";
29
30 private static final String PPPOE_SERVER_CONNECT_POINT = "pppoeServerConnectPoint";
31 private static final String OLT_CONNECT_POINT = "oltConnectPoint";
32 private static final String PPPOE_MAC_ADDRESS = "pppoeMacAddress";
33
34 @Override
35 public boolean isValid() {
36 return hasOnlyFields(PPPOE_SERVER_CONNECT_POINT, OLT_CONNECT_POINT, PPPOE_MAC_ADDRESS) &&
37 hasFields(PPPOE_SERVER_CONNECT_POINT, OLT_CONNECT_POINT, PPPOE_MAC_ADDRESS);
38 }
39
40 /**
41 * Gets the PPPoE server connect point.
42 *
43 * @return PPPoE server connect point
44 */
45 public ConnectPoint getPppoeServerConnectPoint() {
46 return ConnectPoint.deviceConnectPoint(object.path(PPPOE_SERVER_CONNECT_POINT).asText());
47 }
48
49 /**
50 * Gets the connect point where the OLT is connected to the ASG.
51 *
52 * @return ASG to OLT connect point
53 */
54 public ConnectPoint getAsgToOltConnectPoint() {
55 return ConnectPoint.deviceConnectPoint(object.path(OLT_CONNECT_POINT).asText());
56 }
57
58 /**
59 * Gets the PPPoE server MAC address.
60 *
61 * @return PPPoE server MAC address
62 */
63 public MacAddress getPppoeMacAddress() {
64 return MacAddress.valueOf(object.path(PPPOE_MAC_ADDRESS).asText());
65 }
66}
67