2 * Copyright (c) 2015 Cisco Systems, Inc. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.lispflowmapping.implementation;
10 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingService;
11 import org.opendaylight.lispflowmapping.interfaces.mappingservice.IMappingServiceShell;
12 import org.opendaylight.lispflowmapping.lisp.util.LispAddressUtil;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkey;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.authkey.container.MappingAuthkeyBuilder;
17 import org.slf4j.Logger;
18 import org.slf4j.LoggerFactory;
21 * Implement Karaf commands to interact with the Mapping Service.
23 * @author Lorand Jakab
26 public class MappingServiceShell implements IMappingServiceShell {
27 protected static final Logger LOG = LoggerFactory.getLogger(MappingServiceShell.class);
29 private final IMappingService mappingService;
31 public MappingServiceShell(final IMappingService mappingService) {
32 this.mappingService = mappingService;
36 public String printMappings() {
37 return mappingService.printMappings();
41 public void addDefaultKeyIPv4() {
42 Eid eid = LispAddressUtil.toEid(new Ipv4Prefix("0.0.0.0/0"), null);
43 MappingAuthkey key = new MappingAuthkeyBuilder().setKeyType(1).setKeyString("password").build();
44 mappingService.addAuthenticationKey(eid, key);