2 * Copyright (c) 2016, 2017 Inocybe Technologies. and others. 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
9 package org.opendaylight.aaa.cli.dmstore;
11 import org.apache.karaf.shell.api.action.Command;
12 import org.apache.karaf.shell.api.action.Option;
13 import org.apache.karaf.shell.api.action.lifecycle.Service;
14 import org.opendaylight.aaa.api.model.Domain;
15 import org.opendaylight.aaa.cli.AaaCliAbstractCommand;
23 @Command(name = "add-domain", scope = "aaa", description = "Add domain.")
24 public class AddDomain extends AaaCliAbstractCommand {
25 @Option(name = "-name",
26 aliases = { "--domainName" },
27 description = "The domain name",
30 private String domainName;
32 @Option(name = "-desc",
33 aliases = { "--domainDescription" },
34 description = "The domain Description",
37 private String domainDesc;
40 public Object execute() throws Exception {
41 if (super.execute() == null) {
42 return LOGIN_FAILED_MESS;
44 Domain domain = new Domain();
45 domain.setDescription(domainDesc);
46 domain.setEnabled(true);
47 domain.setName(domainName);
48 domain = identityStore.writeDomain(domain);
50 return "Domain " + domainName + " has been created, Domain Id is " + domain.getDomainid();