blob: 2eac0affef3db11309213e0bef4a330bcb494995 [file] [log] [blame]
yoonseonc6a69272017-01-12 18:22:20 -08001/*
2 * Copyright 2017-present Open Networking Laboratory
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.onosproject.incubator.net.virtual;
18
19import org.onlab.osgi.DefaultServiceDirectory;
20import org.onlab.osgi.ServiceDirectory;
21
22import static com.google.common.base.Preconditions.checkNotNull;
23
24/**
25 * Basis for virtual network service.
26 */
27public abstract class AbstractVnetService
28 implements VnetService {
29
30 private static final String NETWORK_NULL = "Network ID cannot be null";
31
32 protected NetworkId networkId;
33 protected VirtualNetworkService manager;
34 protected ServiceDirectory serviceDirectory;
35
36 public AbstractVnetService(VirtualNetworkService manager,
37 NetworkId networkId) {
38 checkNotNull(networkId, NETWORK_NULL);
39 this.manager = manager;
40 this.networkId = networkId;
41 this.serviceDirectory = new DefaultServiceDirectory();
42 }
43
44 @Override
45 public NetworkId networkId() {
46 return this.networkId;
47 }
48}