blob: ea2d9838d202fea916063e036c647609f579af2d [file] [log] [blame]
Jonathan Hart5e8689c2016-02-16 13:06:26 -08001/*
2 * Copyright 2016 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.igmp;
18
19import com.fasterxml.jackson.databind.JsonNode;
20import org.onlab.packet.IpAddress;
21import org.onosproject.core.ApplicationId;
22import org.onosproject.net.config.Config;
23import org.onosproject.net.mcast.McastRoute;
24
25import java.util.ArrayList;
26import java.util.List;
27
28/**
29 * Created by jono on 2/16/16.
30 */
31public class IgmpSsmTranslateConfig extends Config<ApplicationId> {
32 private static final String SSM_TRANSLATE = "ssmTranslate";
33 private static final String SOURCE = "source";
34 private static final String GROUP = "group";
35
36 public List<McastRoute> getSsmTranslations() {
37 List<McastRoute> translations = new ArrayList();
38 for (JsonNode node : array) {
39 translations.add(
40 new McastRoute(
41 IpAddress.valueOf(node.path(SOURCE).asText().trim()),
42 IpAddress.valueOf(node.path(GROUP).asText().trim()),
43 McastRoute.Type.STATIC));
44 }
45
46 return translations;
47 }
48}