Copyright (c) 2012-2014 by Cisco Systems, Inc.

This sample code is provided "AS-IS" for use, modification, and
redistribution, provided that the copyright notice and this following
list of conditions are retained and/or reproduced in your
distribution. To the maximum extent permitted by law, Cisco Systems,
Inc., its subsidiaries and affiliates hereby disclaim all express,
implied, and/or statutory warranties, including duties or conditions
of merchantability, fitness for a particular purpose, and
non-infringement of intellectual property rights. IN NO EVENT WILL
CISCO SYSTEMS, ITS SUBSIDIARIES OR AFFILIATES BE LIABLE TO ANY OTHER
PARTY FOR THE COST OF PROCURING SUBSTITUTE GOODS OR SERVICES, LOST
PROFITS, LOSS OF USE, LOSS OF DATA, OR ANY INCIDENTAL, CONSEQUENTIAL,
DIRECT, INDIRECT, OR SPECIAL DAMAGES, ARISING OUT OF THIS OR ANY OTHER
AGREEMENT RELATING TO THE SAMPLE CODE.

You agree to defend, indemnify, and hold harmless Cisco Systems, and
any of its directors, officers, employees, agents, affiliates, or
subsidiaries from and against all losses, damages, costs and
liabilities arising from your use, modification, and distribution of
the sample code.

Cisco Systems does not certify or endorse your use of the sample code,
nor is any support or other service provided in connection with the
sample code.

---------------------------------
BDEO - Build, Deploy, Execute OVF
---------------------------------

bdeo.sh is an example script illustrating how to create a custom OVF
descriptor (see also README-OVF.txt) that defines a properly
provisioned Cisco CSR 1000V virtual machine (VM) and provides the
capability to define various configuration of the IOS-XE software
running in this VM, then optionally deploy the OVF to an ESXi server
and create a VM.

The script can be run with the option "-help" or "-h" to provide a
listing of supported parameters and several examples of usage. A few
highlights are presented here.

* BDEO takes an ISO image (as well as the other files included in
  this distribution, including this README) and generates a fully
  structured OVF package containing these files and associated
  configuration of hardware and software.

* BDEO can output an OVF package, an OVA archive, and/or a .zip file
  containing the OVF package (for easier distribution and
  uncompression on Windows hosts).

* Appropriate defaults are provided for all hardware parameters
  (number of CPUs, amount of RAM, etc.) but these can be overridden by
  an advanced user (note that non-standard hardware configurations are
  typically NOT supported by Cisco!)

NOTE: The CSR 1000V OVA has been enhanced in IOS XE release 3.12
and later to provide multiple user-selectable configuration
profiles. BDEO has not been extended to construct an enhanced OVA of
this type.

* By default the created OVF descriptor will define all software
  configuration properties supported by the CSR 1000V (see also
  README-OVF.txt) but provision no default values for these properties
  (permitting these properties to be interactively configured at
  deployment time through a tool such as VMware's vSphere client
  software). BDEO is also capable to specifying custom defaults for
  any or all of these properties.

* BDEO can take in a text file (using the "-bootstrap" option)
  containing a series of IOS-XE CLI configuration commands and embed
  these commands into the OVF descriptor. These commands, in addition
  to the software configuration properties mentioned above and
  described in README-OVF.txt, will be applied at startup time.

NOTE: custom property defaults and bootstrap CLI can only be added
when constructing a new OVA from an ISO file. BDEO does not support
modification of an existing OVA, and if BDEO is invoked with an OVA as
input rather than an ISO, all property and bootstrap options will be
silently ignored.

* BDEO provides a set of parameters (the "-deploy" option and related)
  to automatically deploy the resulting OVF or OVA to an ESXi server.
  If the "-poweron" parameter is set, the VM will even be
  automatically powered on and started up.

NOTE: this deployment feature requires the "ovftool" utility provided
by VMware, Inc. This utility can be obtained from:
http://communities.vmware.com/community/vmtn/server/vsphere/automationtools/ovf

NOTE ALSO: this feature requires VMware vCenter - it will not work on
standalone ESX/ESXi hosts.

-----------------
Examples of Usage
-----------------

The simplest possible usage is as follows:
  bdeo.sh -image csr1000v.iso
This will create an OVA archive containing the specified ISO image and
an OVF descriptor that defines hardware configuration appropriate for
the CSR 1000V and provides a framework (but no default values) for all
of the software properties supported by the CSR 1000V.

A more advanced example is as follows:
  bdeo.sh -image csr1000v.iso \
          -ip_address 10.1.1.100/24 \
          -mgmt_gateway 10.1.1.1 \
          -ios_username "admin" \
          -ios_password "secret" \
          -ssh
The OVA created from this command will include software configuration
sufficient to bootstrap any new virtual machine created from this OVA
to the point where an administrator can remotely login via SSH to
10.1.1.100 using username "admin" and password "secret" in order to
apply any further configuration desired.

A still more advanced example is as follows:
  bdeo.sh -image csr1000v.iso \
          -ip_address 10.1.1.100/24 \
          -mgmt_gateway 10.1.1.1 \
          -ios_username "admin" \
          -ios_password "secret" \
          -ssh \
          -accept_all_eulas \
          -activate_csr_license \
          -bootstrap "my_configs.txt"
This will create an OVA that not only bootstraps the configuration for
adminstrative access, but also automatically installs a CSR
evaluation license (accepting the EULA on your behalf) and applies any
additional configuration commands defined in the provided text
file. These could include, for example, IP routing configuration,
bringing up the other (non-management) interfaces enabled by
activating the license, and much more.

Let's keep building on this example...:
  bdeo.sh -image csr1000v.iso \
          -ip_address 10.1.1.100/24 \
          -mgmt_gateway 10.1.1.1 \
          -ios_username "admin" \
          -ios_password "secret" \
          -ssh \
          -accept_all_eulas \
          -activate_csr_license \
          -bootstrap "my_configs.txt" \
          -deploy "172.18.67.1/UCS/host/172.18.67.100" \
          -username "administrator" \
          -password "password" \
          -poweron
This will create the same bootstrapped and licensed OVA as the
previous example, but will furthermore automatically deploy the OVA to
the indicated vCenter/ESXi server and host (using the provided credentials),
generate a VM from this OVA, and power on the VM.

Voila - a fully operational CSR 1000V VM in a single command!
