3 # Copyright (c) 2016 Cisco and/or its affiliates.
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:
8 # http://www.apache.org/licenses/LICENSE-2.0
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.
16 """This script provides copy and installation of VPP build deb packages.
17 As destinations are used all DUT nodes from the topology file."""
23 from resources.libraries.python.ssh import SSH
26 """Copy and installation of VPP packages."""
28 parser = argparse.ArgumentParser()
29 parser.add_argument("-t", "--topo", required=True,
31 parser.add_argument("-d", "--directory", required=True,
32 help="Installation directory")
33 parser.add_argument("-p", "--packages", required=True, nargs='+',
34 help="Packages paths to copy")
35 args = parser.parse_args()
36 topology_file = args.topo
37 packages = args.packages
38 install_dir = args.directory
40 work_file = open(topology_file)
41 topology = load(work_file.read())['nodes']
44 if topology[node]['type'] == "DUT":
46 ssh.connect(topology[node])
48 # Copy packages from local path to installation dir
50 ssh.scp(local_path=deb, remote_path=install_dir)
52 # Installation of VPP deb packages
53 ret, _, err = ssh.exec_command_sudo(
54 "dpkg -i {}*.deb".format(install_dir))
56 print "Installation unsuccessful:\n{}".format(err)
59 if __name__ == "__main__":