Open Ethernet Networking (OpEN) API Guide and Reference Manual
3.6.0.3
|
As part of the Broadcom Linux RPM distribution, Broadcom supplies a Chef client that runs on the switch. Chef is a tool that automates infrastructure deployment. See http://www.opscode.com/chef for more information.
It is assumed that the reader is familiar with the concepts of Chef:
The Chef client requires a number of RPMs to be installed in order for it to execute. To install the Chef client first install RPM as defined in the Bootstrapping RPM section. Then use the rpm-install.sh helper script, described in the RPM Package Installation section, to install the Chef client and all of its dependencies as shown below:
(ICOS Routing) #linuxsh # cd /mnt/fastpath # ./rpm-install.sh chef mypath 10.27.9.99 # ...... # rpm -q rubygem-chef rubygem-chef-11.4.0-1.1.el6.noarch # which chef-client /bin/chef-client # exit (ICOS Routing) #
Follow the instructions below to install Chef client and all of its dependencies:
unix% sudo apt-get install ruby ruby-dev libopenssl-ruby rdoc ri irb build-essential wget ssl-cert curl rubygems unix% sudo gem install chef --no-ri --no-rdoc
The Chef client on the switch requires SWIG files from the OpEN API to be built and installed. These are installed on the switch by default, and no further action is required if you are using an unmodified Open API.
If you have modified the OpEN API then you should ensure the Ruby language bindings are up to date. See the Ruby section of the OpEN API and Language Bindings section for further details.
The default switch hostname is localhost. This should be changed to something unique for the host by editing the /etc/sysconfig/network file and then executing the command below. Note that if you change your hostname then you must update your /etc/hosts file as described in section Configuring Name Resolution below.
# . /etc/sysconfig/network; hostname $HOSTNAME
Name resolution is a useful feature to configure on the Chef client, and is required if you change the default hostname of the switch.
Name resolution could be done by configuring DNS as described in section DNS Configuration. You should then ensure that your /etc/resolv.conf file contains a search entry (e.g. search broadcom.com), that you have run crlinks.sh, and that your hostname is in your DNS server.
Alternatively you can configure name resolution using the /etc/hosts files. To do this add your hostname and Chef server name as follows. Note that this assumes your Chef server is called chef, your hostname is tor1 and that your domain is broadcom.com.
10.11.12.13 chef chef.broadcom.com 10.11.12.14 tor1 tor1.broadcom.com
Note that you will also need to add a search entry to your /etc/resolv.conf file (e.g. search broadcom.com).
Once name resolution has been configured, you should ping your Chef server to validate connectivity.
The file /etc/chef/client.rb should be edited and the chef_server_url modified to point to your Chef server. If you wish to modify the name of the node then you should also edit the node_name value and put a matching entry in /etc/hosts.
The chef_server_url can be specified as an IPv4 address such as 10.11.12.13, or as a host name such as chefserver.mycorp.com. In the case when a host name is used, that name must either be in /etc/hosts, or DNS should be configured (see the Configuring Name Resolution section).
The Chef client requires the /etc/chef/validation.pem file to be created before it can be executed. This can be created on your Chef workstation by issuing the following command:
Workstation# knife configure client ./
This will create a client.rb and validation.pem file in the current directory. The validation.pem file should be copied to /etc/chef/ on the switch using either TFTP or (if available) SCP. The client.rb file can be ignored.
The Chef client requires that time be synchronized between the Chef nodes, server and workstation. The simplest way to do this is to synchronize with a central time server using NTP. To synchronize the Chef client on the switch add your time servers to /etc/ntp/step-tickers and then use the ntpdate server. This will synchronize the switches time to your NTP server each time the switch boots.
(ICOS Routing) #linuxsh # cd /etc/ntp # echo 10.11.12.13 >> step-tickers # # chkconfig ntpdate on # /etc/init.d/ntpdate start ntpdate: Synchronizing with time server: [ OK ] # date Sat Apr 27 03:14:26 UTC 2013 # # exit (ICOS Routing) #
Once configured, the Chef client can be started by executing the chef-client command. This will start the client as a single shot in the foreground, and is useful for initial debug.
Note: If you have previously had a Chef node with the same name as this node, or if you are doing a new Chef installation on a previously used switch, then you should delete the node from the Chef server before starting the Chef client. To do this use the Chef webui or knife.
(ICOS Routing) #linuxsh # chef-client Starting Chef Client, version 11.4.0 ... Chef Client finished, 0 resources updated # exit (ICOS Routing) #
To have the Chef client start on each boot, use chkconfig:
(ICOS Routing) #linuxsh # chkconfig chef-client on # /etc/init.d/chef-client start Starting chef-client: [ OK ] # exit (ICOS Routing) #
Note that by default the Chef client will only check its configuration every 30 minutes. To modify this, uncomment and change the interval
value in the /etc/chef/client.rb file.
As part of the OpEN ADK, Broadcom supplies an example cookbook and role that uses the Broadcom OpEN APIs. The cookbook is called boa (Broadcom OpEN API), and can be found in the examples/chef/cookbooks directory of the ADK. The example role can be found in examples/chef/roles. For further details see the Example Chef Cookbook and Role section.
As part of the OpEN ADK, Broadcom supplies an example cookbook, Netdev, which manages network resources to work with devices, powered by Broadcom ICOS. Netdev is a vendor-neutral network abstraction framework, developed by Arista Networks and contributed to the DevOps community for free. For more information refer to https://github.com/aristanetworks/chef-eos.
For information related to Netdev installation and usage, refer to Example Chef Netdev Provider section.
As part of the RPM installation, the brcm-misc module installs Ohai extensions into /etc/chef/plugins on the switch. These are used by the Ohai gem to extend the information that is supplied about the platform, ICOS and the OpEN APIs. Below is an example, obtained from the Chef webui, of some of the attributes that are made available by the Broadcom Ohai extension.
Further Ohai extensions can be added by modifying the /etc/chef/plugins files.