blob: b3e1d184221fa772dc6afc5336786848cfa80a8f [file] [log] [blame]
yoonseonc6a69272017-01-12 18:22:20 -08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2017-present Open Networking Foundation
yoonseonc6a69272017-01-12 18:22:20 -08003 *
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.onosproject.incubator.net.virtual;
18
yoonseonc6a69272017-01-12 18:22:20 -080019import org.onlab.osgi.ServiceDirectory;
20
21import static com.google.common.base.Preconditions.checkNotNull;
22
23/**
24 * Basis for virtual network service.
25 */
26public abstract class AbstractVnetService
27 implements VnetService {
28
29 private static final String NETWORK_NULL = "Network ID cannot be null";
30
31 protected NetworkId networkId;
32 protected VirtualNetworkService manager;
33 protected ServiceDirectory serviceDirectory;
34
35 public AbstractVnetService(VirtualNetworkService manager,
36 NetworkId networkId) {
37 checkNotNull(networkId, NETWORK_NULL);
38 this.manager = manager;
39 this.networkId = networkId;
yoonseon322c9c32016-12-07 16:47:02 -080040 this.serviceDirectory = manager.getServiceDirectory();
yoonseonc6a69272017-01-12 18:22:20 -080041 }
42
43 @Override
44 public NetworkId networkId() {
45 return this.networkId;
46 }
47}