blob: 33581eb3e91c9cc6c5cf9a9211b13ee20637f8d6 [file] [log] [blame]
Phaneendra Manda119469d2015-12-03 15:42:37 +05301/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
Phaneendra Manda119469d2015-12-03 15:42:37 +05303 *
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 */
16package org.onosproject.vtnweb.web;
17
Ray Milkeyd84f89b2018-08-17 14:54:17 -070018import org.osgi.service.component.annotations.Activate;
19import org.osgi.service.component.annotations.Component;
20import org.osgi.service.component.annotations.Deactivate;
21import org.osgi.service.component.annotations.Reference;
22import org.osgi.service.component.annotations.ReferenceCardinality;
Phaneendra Manda119469d2015-12-03 15:42:37 +053023import org.onosproject.codec.CodecService;
24import org.onosproject.vtnrsc.FlowClassifier;
25import org.onosproject.vtnrsc.PortChain;
26import org.onosproject.vtnrsc.PortPair;
27import org.onosproject.vtnrsc.PortPairGroup;
Phaneendra Manda8db7d092016-06-04 00:17:24 +053028import org.onosproject.vtnrsc.ServiceFunctionGroup;
Phaneendra Manda119469d2015-12-03 15:42:37 +053029import org.slf4j.Logger;
30import org.slf4j.LoggerFactory;
31
32/**
33 * Implementation of the JSON codec brokering service for VTN app.
34 */
35@Component(immediate = true)
36public class VtnCodecRegistrator {
37
38 private static Logger log = LoggerFactory.getLogger(VtnCodecRegistrator.class);
39
Ray Milkeyd84f89b2018-08-17 14:54:17 -070040 @Reference(cardinality = ReferenceCardinality.MANDATORY)
Phaneendra Manda119469d2015-12-03 15:42:37 +053041 protected CodecService codecService;
42
43 @Activate
44 public void activate() {
45 codecService.registerCodec(PortPair.class, new PortPairCodec());
46 codecService.registerCodec(PortPairGroup.class, new PortPairGroupCodec());
47 codecService.registerCodec(FlowClassifier.class, new FlowClassifierCodec());
48 codecService.registerCodec(PortChain.class, new PortChainCodec());
Phaneendra Manda8db7d092016-06-04 00:17:24 +053049 codecService.registerCodec(ServiceFunctionGroup.class, new ServiceFunctionCodec());
Phaneendra Manda119469d2015-12-03 15:42:37 +053050 log.info("Started");
51 }
52
53 @Deactivate
54 public void deactivate() {
55 log.info("Stopped");
56 }
57}