2 * Copyright (c) 2015 Huawei, Inc. 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.nemo.tool.sandbox.models;
11 import org.opendaylight.nemo.tool.sandbox.CmdExecutor;
13 import java.util.ArrayList;
14 import java.util.List;
15 import org.slf4j.Logger;
16 import org.slf4j.LoggerFactory;
18 * Created by hj on 12/8/15.
20 public class Cache extends Host {
21 private static Logger log = LoggerFactory.getLogger(Cache.class);
22 public Cache(String name,String uuId) {
23 super(NodeType.CACHE,name, uuId);
27 protected List<String> generateCommands() {
28 List<String> commands = new ArrayList<String>(generateHost());
31 commands.add("ip netns exec "+getName()+"echo 1 > /proc/sys/net/ipv4/ip_forward");
33 if(connectors.size()>0) {
34 commands.add("ip netns exec route add default dev "+ connectors.get(0));
40 public void uninstall(){
42 CmdExecutor.sshExecute("ip netns del " + getName());
43 } catch (Exception e) {
44 // TODO Auto-generated catch block
45 log.error("Exception:",e);