Merge pull request #1 from opencomputeproject/master

merge from OCP/ONL to my local forked branch
This commit is contained in:
Lewis Kang
2016-03-14 09:52:27 +08:00
72 changed files with 1565 additions and 117 deletions

View File

@@ -13,8 +13,11 @@
. setup.env
set -e
if [ -n "$ONL_AUTOBUILD" ]; then
make all
exit 0
else
echo Ready to build OpenNetworkLinux.
fi

View File

@@ -4,6 +4,7 @@
#
############################################################
ifneq ($(MAKECMDGOALS),docker)
ifneq ($(MAKECMDGOALS),docker-debug)
ifndef ONL
$(error Please source the setup.env script at the root of the ONL tree)
@@ -15,13 +16,22 @@ all: amd64 ppc
$(MAKE) -C REPO build-clean
onl-amd64 onl-x86 x86 x86_64 amd64:
$(MAKE) -C packages/base ARCHES=amd64,all
$(MAKE) -C packages/base/amd64/kernels
$(MAKE) -C packages/base/amd64/initrds
$(MAKE) -C packages/base/amd64/onlp
$(MAKE) -C packages/base/amd64/onlp-snmpd
$(MAKE) -C packages/base/amd64/faultd
$(MAKE) -C builds/amd64/rootfs
$(MAKE) -C builds/amd64/swi
$(MAKE) -C builds/amd64/installer/legacy
onl-ppc ppc:
$(MAKE) -C packages/base ARCHES=powerpc,all
$(MAKE) -C packages/base/powerpc/kernels
$(MAKE) -C packages/base/powerpc/initrds
$(MAKE) -C packages/base/powerpc/onlp
$(MAKE) -C packages/base/powerpc/onlp-snmpd
$(MAKE) -C packages/base/powerpc/faultd
$(MAKE) -C packages/base/powerpc/fit
$(MAKE) -C builds/powerpc/rootfs
$(MAKE) -C builds/powerpc/swi
$(MAKE) -C builds/powerpc/installer/legacy
@@ -30,6 +40,7 @@ rpc rebuild:
$(ONLPM) --rebuild-pkg-cache
endif
endif
.PHONY: docker
@@ -43,3 +54,7 @@ docker_check:
docker: docker_check
@docker/tools/onlbuilder -$(VERSION) --isolate --hostname onlbuilder$(VERSION) --pull --autobuild --non-interactive
# create an interative docker shell, for debugging builds
docker-debug: docker_check
@docker/tools/onlbuilder -$(VERSION) --isolate --hostname onlbuilder$(VERSION) --pull

View File

@@ -1,7 +1,8 @@
include $(ONL)/make/config.amd64.mk
KERNELS := $(shell $(ONLPM) --find-file onl-kernel-3.9.6-x86-64-all:amd64 kernel-3.9.6-x86-64-all) \
$(shell $(ONLPM) --find-file onl-kernel-3.2-deb7-x86-64-all:amd64 kernel-3.2-deb7-x86_64-all)
$(shell $(ONLPM) --find-file onl-kernel-3.2-deb7-x86-64-all:amd64 kernel-3.2-deb7-x86_64-all) \
$(shell $(ONLPM) --find-file onl-kernel-3.18-x86-64-all:amd64 kernel-3.18-x86_64-all)
INITRD := $(shell $(ONLPM) --find-file onl-loader-initrd:amd64 onl-loader-initrd-amd64.cpio.gz)
PLATFORMS := $(shell $(ONLPM) --platform-manifest onl-loader-initrd:amd64)

View File

@@ -69,4 +69,4 @@
- onl-faultd
- onl-loader-initscripts
- onlp-snmpd
- oom-shim

View File

@@ -58,6 +58,7 @@ Configure:
- 'initdev defaults'
- 'onl-platform-baseconf defaults'
- 'faultd defaults'
- 'onlpd defaults'
- 'snmpd remove'
- 'onlp-snmpd remove'
- 'ssh defaults'

View File

@@ -68,5 +68,6 @@
- onl-faultd
- onl-loader-initscripts
- onlp-snmpd
- oom-shim

View File

@@ -58,6 +58,7 @@ Configure:
- 'initdev defaults'
- 'onl-platform-baseconf defaults'
- 'faultd defaults'
- 'onlpd defaults'
- 'snmpd remove'
- 'onlp-snmpd remove'
- 'ssh defaults'

View File

@@ -0,0 +1,12 @@
FROM opennetworklinux/builder7:1.0
MAINTAINER Rob Sherwood <rob.sherwood@bigswitch.com>
RUN apt-get update && apt-get install -y \
libpcap-dev \
telnet \
gdb
#
# Docker shell and other container tools.
#
COPY docker_shell /bin/docker_shell
COPY container-id /bin/container-id

View File

@@ -0,0 +1,20 @@
VERSION=1.1
USER=opennetworklinux
REPO=builder7
TOOLS=../../../tools/docker_shell ../../../tools/container-id
build: check_version
cp $(TOOLS) .
docker build -t $(USER)/$(REPO):$(VERSION) .
rm -rf $(notdir $(TOOLS))
#
# Todo: Query remote repository to see if the request version already exists to avoid accidental overwrites
# when a new image is built but the VERSION variable is not updated.
#
check_version:
push:
docker push $(USER)/$(REPO):$(VERSION)

View File

@@ -127,8 +127,7 @@ RUN echo 'APT::Get::AllowUnauthenticated "true";\nAPT::Get::Assume-Yes "true";'
dpkg -i texinfo_4.13a.dfsg.1-10_amd64.deb && \
wget "http://ftp.us.debian.org/debian/pool/main/e/emdebian-crush/xapt_2.2.19_all.deb" && \
dpkg -i xapt_2.2.19_all.deb && \
xapt -a powerpc libedit-dev ncurses-dev libsensors4-dev libwrap0-dev libssl-dev libsnmp-dev
xapt -a powerpc libedit-dev ncurses-dev libsensors4-dev libwrap0-dev libssl-dev libsnmp-dev
# update-alternatives --install /usr/bin/powerpc-linux-gnu-gcc powerpc-linux-gnu-gcc 10 &&
#

View File

@@ -0,0 +1,12 @@
FROM opennetworklinux/builder8:1.0
MAINTAINER Rob Sherwood <rob.sherwood@bigswitch.com>
RUN apt-get update && apt-get install -y \
libpcap-dev \
telnet \
gdb
#
# Docker shell and other container tools.
#
COPY docker_shell /bin/docker_shell
COPY container-id /bin/container-id

View File

@@ -0,0 +1,19 @@
VERSION=1.1
USER=opennetworklinux
REPO=builder8
TOOLS=../../../tools/docker_shell ../../../tools/container-id
build: check_version
cp $(TOOLS) .
docker build -t $(USER)/$(REPO):$(VERSION) .
rm -rf $(notdir $(TOOLS))
#
# Todo: Query remote repository to see if the request version already exists to avoid accidental overwrites
# when a new image is built but the VERSION variable is not updated.
#
check_version:
push:
docker push $(USER)/$(REPO):$(VERSION)

View File

@@ -1,6 +1,6 @@
common:
arch: all
version: 1.0.0
version: 1.1.0
copyright: Copyright 2013, 2014, 2015 Big Switch Networks
maintainer: support@bigswitch.com

View File

@@ -154,6 +154,15 @@ for u in ops.addusers:
if ops.start_cacher:
execute("/etc/init.d/apt-cacher-ng start", "The apt-cacher-ng service could not be started.")
logger.debug("checking if qemu-ppc exists")
if os.path.isfile("/proc/sys/fs/binfmt_misc/qemu-ppc"):
logger.debug("qemu-ppc already exists")
else:
if not os.path.ismount("/proc/sys/fs/binfmt_misc"):
execute("sudo mount binfmt_misc -t binfmt_misc /proc/sys/fs/binfmt_misc", "The binfmt_misc system could not be mounted.")
execute("sudo /etc/init.d/binfmt-support start", "The binfmt-support service could not be started.")
# Fixme: change this to os.execvp()
c = "/usr/bin/sudo -E -u %s %s" % (g_user.name, " ".join(ops.command))
sys.exit(execute(c))

View File

@@ -17,8 +17,8 @@ g_current_user = getpass.getuser()
g_current_uid = os.getuid()
g_timestamp = datetime.datetime.now().strftime("%Y-%m-%d.%H%M%S")
g_builder7_image_name="opennetworklinux/builder7:1.0"
g_builder8_image_name="opennetworklinux/builder8:1.0"
g_builder7_image_name="opennetworklinux/builder7:1.1"
g_builder8_image_name="opennetworklinux/builder8:1.1"
g_default_image_name=g_builder7_image_name
g_default_container_name = "%s_%s" % (g_current_user, g_timestamp)
@@ -96,6 +96,10 @@ ap.add_argument("--volumes",
metavar='DIRECTORY',
default=[])
ap.add_argument("--no-mount-current",
help="Do not mount the current working directory. The default is the current working directory and $HOME",
action='store_true')
ap.add_argument("--autobuild",
help="Automatic build in isolation mode.",
action='store_true')
@@ -159,6 +163,11 @@ if ops.exec_:
else:
ops.volumes += [ '/lib/modules' ]
if not ops.no_mount_current:
# Add the current working directory to the volume list.
ops.volumes.append(os.getcwd())
g_arg_d['volume_options'] = " ".join( [ " -v %s:%s " % (v, v) for v in ops.volumes ] )
g_docker_arguments = "docker run --privileged %(interactive)s -t -e DOCKER_IMAGE=%(image)s --name %(name)s %(ssh_options)s %(volume_options)s " % g_arg_d

View File

@@ -12,29 +12,38 @@ ONL builds with Docker so the only requirements on the build system is:
- docker # to grab the build workspace
- binfmt-support # kernel support for ppc builds
- About 40G of disk free space # to build all images
- At least 4G of ram and 4G of swap # compilation is memory intensive
All of the testing is done with Debian, other Linux distributions may work, but we suggest using Debian 8.
# apt-get install lxc-docker binfmt-support
# apt-get install binfmt-support
then follow the instructions at: https://docs.docker.com/engine/installation/debian/
Build ONL Summary
------------------------------------------------------------
The easiest way to build is to use the autobuild script:
The easiest way to build is to use the make docker command:
#> git clone https://github.com/opencomputeproject/OpenNetworkLinux
#> tools/autobuild/build.sh
#> cd OpenNetworkLinux
#> make docker
This will build a Debian 7 based ONL from the master branch
To build a Debian 8 based ONL simply run:
To build a Debian 8 based ONL run:
#> tools/autobuild/build.sh -8
#> git clone https://github.com/opencomputeproject/OpenNetworkLinux
#> cd OpenNetworkLinux
#> export VERSION=8
#> make docker
If you would like to build by hand you can do the following:
#> git clone https://github.com/opencomputeproject/OpenNetworkLinux
#> cd OpenNetworkLinux
#> make docker # enter the docker workspace
#> docker/tools/onlbuilder (-8) # enter the docker workspace
#> apt-cacher-ng
#> source setup.env # pull in necessary environment variables
#> make amd64 ppc # make onl for $platform (currently amd64 or powerpc)
The resulting ONIE installers are in
@@ -50,9 +59,6 @@ RELEASE/jessie/amd64/ONL-2.0.0_ONL-OS_2015-12-12.0252-ffce159_AMD64.swi
Docker installer oneliner (for reference: see docker.com for details)
# apt-get install -y lxc-docker
or
# wget -qO- https://get.docker.com/ | sh
@@ -122,3 +128,86 @@ This installer image can be served to ONIE on Quanta or Accton platforms:
#> ls *INSTALLER
ONL-2.0.0_ONL-OS_2015-12-12.0252-ffce159_PPC_INSTALLER
#>
Example setup on new Debian 8.2 installation
------------------------------------------------------------
Install sudo and add yourself to the sudoers:
As root:
apt-get install sudo
vi /etc/sudoers.d/username
Add the line:
username ALL=(ALL:ALL) ALL
Add the docker key:
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
gpg: key 2C52609D: public key "Docker Release Tool (releasedocker) <docker@docker.com>" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Install necessary items, make, binfmt-support and apt-transport-https (for docker):
sudo apt-get install apt-transport-https make binfmt-support
Add the docker repository to your system:
sudo vi /etc/apt/sources.list.d/docker.list
Add the following line to the file:
deb https://apt.dockerproject.org/repo debian-jessie main
Install Docker:
sudo apt-get update
sudo apt-get install docker-engine
Test Docker:
sudo docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
b901d36b6f2f: Pull complete
0a6ba66e537a: Pull complete
Digest: sha256:8be990ef2aeb16dbcb9271ddfe2610fa6658d13f6dfb8bc72074cc1ca36966a7
Status: Downloaded newer image for hello-world:latest
Hello from Docker.
This message shows that your installation appears to be working correctly.
Add yourself to the docker group:
sudo gpasswd -a snoble docker
Adding user snoble to group docker
logout and log back in for the group to take effect:
Clone the OpenNetworkLinux repository:
git clone https://github.com/opencomputeproject/OpenNetworkLinux.git
Cloning into 'OpenNetworkLinux'...
Checking connectivity... done.
Build OpenNetworkLinux:
#> cd OpenNetworkLinux/
#> make docker
#> Pulling opennetworklinux/builder7:1.0…
Or:
#> docker/tools/onlbuilder
#> source setup.env
#> apt-cacher-ng
#> make onl-x86 onl-ppc

View File

@@ -109,9 +109,8 @@ Now press RETURN here to jump into ONIE''s manual installer mode. You should se
Then simply download the latest ONL installer for the appropriate
architecture (powerpc or amd64) from the website and run it.
ONIE:/ # install_url http://opennetlinux.org/binaries/latest-amd64.installer
ONIE:/ # install_url http://opennetlinux.org/binaries/latest-$ARCH.installer
ONIE:/ # install_url http://opennetlinux.org/binaries/latest-powerpc.installer
Connecting to opennetlinux.org (107.170.237.53:80)
Open Network Installer running under ONIE.
Installer Version: Open Network Linux e148b7a (powerpc.all,2014.05.21.18.57,e148b7a90131c07eb8d49f74316baf8f2aae92c6)
@@ -123,7 +122,26 @@ architecture (powerpc or amd64) from the website and run it.
...
Note:
1) If there is different OS(other than ONL) running on the switch.
Then halt the booting process at U-boot mode, Then check for the ONIE
details in the environment(=> printenv). Open the ONIE in rescue mode,
while ONIE has many different installation modes,
we recommend the rescue mode for doing a manual (read: via console)
because it disables the automatic ONIE server discovery.
Then run (=> run onie_rescue) command to take you to the ONIE environment.
2) For development purpose, to load freshly build ONL installer from directly ONIE.
Run a http server from the build machine (example:python -m SimpleHTTPServer 8000) and access it as,
example: ONIE:/ # install_url http://buildmachineIPAddress:/path/to/directory/onl-09b7bba-powerpc-all.2016.02.05.05.17.installer # update for specific file/date/build
Also, you can use install via scp with two steps,
example: ONIE:/ # scp [username]@buildmachineIPAddress:/path/to/directory/onl-09b7bba-powerpc-all.2016.02.05.05.17.installer ONL.installer # update for specific file/date/build
ONIE:/ # sh ONL.installer
ONL NFS Root Directory
------------------------------------------------

View File

@@ -62,16 +62,19 @@ ONL Manual Install
2) Boot switch and choose "ONIE: Rescue" to go to ONIE''s interactive mode
3) From the ONIE# prompt run "install_url http://opennetlinux.org/binaries/latest-wedge.installer"
3) From the ONIE# prompt run "install_url http://opennetlinux.org/binaries/latest-wedge-2.0.installer"
4) Wait for the install to finish and the system to reboot
5) One the onl login prompt appears login with the username root and the
password "onl"
6) You can now change the root password
6) Configure the ma1 interface either via dhcp (dhclient ma1) or manually
7) Configure the ma1 interface either via dhcp (dhclient ma1) or manually
7) Install fboss using the commands
#> apt-get update
#> apt-get install fboss
8) From the command prompt you can start fboss by using the command
"service fboss_wedge_agent start"
@@ -126,19 +129,35 @@ Now press RETURN here to jump into ONIE''s manual installer mode. You should se
Then simply download the latest ONL wedge installer from the website and run it.
ONIE:/ # install_url http://opennetlinux.org/binaries/latest-wedge.installer
ONIE:/ # install_url http://opennetlinux.org/binaries/latest-wedge-2.0.installer
Connecting to opennetlinux.org (107.170.237.53:80)
Open Network Installer running under ONIE.
Installer Version: Open Network Linux 019421c (amd64.all,2015.11.17.06.23,019421c116940d87d5a41100d1b8a64cbba50252)
Detected platform: x86-64-accton-wedge-16x-r0
Installing in standalone mode.
Unpacking Open Network Linux installer files...
Installing Open Network Linux Software Image (ONL-2.0.0_ONL-OS_2016-02-12.2304-b9b7e50_AMD64.swi)...
Installation finished. No error reported.
Install finished. Rebooting to Open Network Linux.
...
Connecting tty=ttyS1 with /sbin/pgetty
Open Network Linux 019421c (amd64.all,2015.11.17.06.23,019421c116940d87d5a41100d1b8a64cbba50252)
Debian GNU/Linux 8 localhost ttyS1
onl-wedge login:
localhost login: root
Password:
Linux localhost 3.2.65-1+deb7u2-OpenNetworkLinux #1 SMP Fri Feb 12 23:10:15 UTC 2016 x86_64
root@localhost:~# apt-get update
root@localhost:~# apt-get install fboss
WARNING: The following packages cannot be authenticated!
folly wangle fbthrift fboss-py fboss-core fboss
Install these packages without verification? [y/N] y
root@localhost:~# service fboss_wedge_agent start
[....] Starting Facebook FBOSS agent: fboss_wedge_agent
Error: OpenNSL library not found, attempting to grab from GitHub
Saving to: /usr/local/lib/libopennsl.so.1
OpenNSL library succesfully installed
[ ok --- Loading linux-kernel-bde linux-user-bde linux-bcm-knet ; Creating devices .
root@localhost:~# service fboss_wedge_agent status
[ ok ] fboss_wedge_agent is running.

View File

@@ -5,9 +5,10 @@ Open Network Linux has a number of internal APIs to simplify porting to
new hardware.
To support a new switch/device, there are three large software components
that need device-specific drivers:
that need device-specific drivers (information only known by the manufacturer
of the switch/device):
1. The ONL/ONIE installer -- how to actually install and boot ONL using ONIE
1. The ONL/ONIE installer -- how to install and boot ONL using ONIE
2. The ONLP platform drivers -- how to manage hardware once ONL is running
3. Any packet forwarding device specific settings
(e.g., front panel port mappings, pre-emphesis settings)
@@ -69,7 +70,7 @@ directory structure for the installer driver is as follows:
# specific ONL OS abstractions (see below)
./$platform/$release/src/lib/install/$platform.sh # Script called from installer.sh to partition
# and install ONL and setup boot params (see below)
./$platform/src/python/$plaform/__init__.py # Platform specific python library (see below)
./$platform/src/python/$platform/__init__.py # Platform specific python library (see below)
ONL Installer src/boot drivers
------------------------------

View File

@@ -9,13 +9,12 @@ Quanta
<table class="table table-striped table-hover">
<thead>
<tr class="info">
<th> Device <th> Ports <th> CPU <th> Forwarding <th> Support Status </tr>
<th> Device <th> Ports <th> CPU <th> Forwarding <th> ONL Certified <th> In Lab <th> ORC <th> OF-DPA <th> OpenNSL <th> SAI </tr>
</thead>
<tr> <td> QuantaMesh T1048-LB9 <td> 48x1G + 4x10G <td> FreeScale P2020 <td> Broadcom BCM56534 (Firebolt3) <td> Supported and Tested </tr>
<tr> <td> QuantaMesh T1048-LB9A <td> 48x1G + 4x10G <td> FreeScale P2020 <td> Broadcom BCM56534 (Firebolt3) <td> Supported, no ONIE, not regularly tested </tr>
<tr> <td> QuantaMesh T3048-LY2 <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56846 (Trident+) <td> Supported and Tested </tr>
<tr> <td> QuantaMesh T3048-LY8 <td> 48x10G + 6x40G <td> Intel Rangely C2758 x86 <td> Broadcom BCM56854 (Trident2) <td> Supported and run in the lab </tr>
<tr> <td> QuantaMesh T5032-LY6 <td> 32x40G <td> Intel Rangely C2758 x86 <td> Broadcom BCM56850 (Trident2) <td> Supported and run in the lab </tr>
<tr> <td> QuantaMesh T1048-LB9 <td> 48x1G + 4x10G <td> FreeScale P2020 <td> Broadcom BCM56534 (Firebolt3) <td> Yes <td> Yes <td> Yes <td> Yes <td> No <td> No </tr>
<tr> <td> QuantaMesh T3048-LY2 <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56846 (Trident+) <td> Yes <td> Yes <td> Yes <td> Yes <td> No <td> No </tr>
<tr> <td> QuantaMesh T3048-LY8 <td> 48x10G + 6x40G <td> Intel Rangely C2758 x86 <td> Broadcom BCM56854 (Trident2) <td> Yes* <td> No <td> No <td> No <td> No <td> No </tr>
<tr> <td> QuantaMesh T5032-LY6 <td> 32x40G <td> Intel Rangely C2758 x86 <td> Broadcom BCM56850 (Trident2) <td> Yes* <td> No <td> No <td> No <td> No <td> No </tr>
</table>
@@ -24,18 +23,20 @@ Accton/Edge-Core
<table class="table table-striped table-hover">
<thead>
<tr class="info">
<th> Device <th> Ports <th> CPU <th> Forwarding <th> Support Status </tr>
<th> Device <th> Ports <th> CPU <th> Forwarding <th> ONL Certified <th> In Lab <th> ORC <th> OF-DPA <th> OpenNSL <th> SAI </tr>
</thead>
<tr> <td> Accton AS4600-54T <td> 48x1G + 4x10G <td> FreeScale P2020 <td> Broadcom BCM56540 (Apollo2) <td> Supported and Tested </tr>
<tr> <td> Accton AS5600-52X <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56846 (Trident+) <td> Supported and Tested </tr>
<tr> <td> Accton AS5610-52X <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56846 (Trident+) <td> Supported and Tested </tr>
<tr> <td> Accton AS5710-54X <td> 48x10G + 6x40G <td> FreeScale P2041 <td> Broadcom BCM56854 (Trident2) <td> Supported and Tested </tr>
<tr> <td> Accton AS6700-32X <td> 32x40G <td> FreeScale P2041 <td> Broadcom BCM56850 (Trident2) <td> Supported and Tested </tr>
<tr> <td> Accton AS5712-54X <td> 48x10G + 6x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56854 (Trident2) <td> Supported and Tested </tr>
<tr> <td> Accton AS6712-32X <td> 32x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56850 (Trident2) <td> Supported and Tested </tr>
<tr> <td> Accton AS5812-54T <td> 48x10G + 6x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56864 (Trident2+) <td> Supported </tr>
<tr> <td> Accton AS5812-54X <td> 48x10G + 6x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56864 (Trident2+) <td> Supported </tr>
<tr> <td> Accton AS6812-32X <td> 32x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56864 (Trident2+) <td> Supported </tr>
<tr> <td> Accton AS4600-54T <td> 48x1G + 4x10G <td> FreeScale P2020 <td> Broadcom BCM56540 (Apollo2) <td> Yes <td> Yes <td> Yes <td> Yes*** <td> Yes*** <td> No </tr>
<tr> <td> Accton AS5600-52X <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56846 (Trident+) <td> Yes <td> Yes <td> Yes <td> No <td> No <td> No </tr>
<tr> <td> Accton AS5610-52X <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56846 (Trident+) <td> Yes <td> Yes <td> Yes <td> No <td> No <td> No </tr>
<tr> <td> Accton AS5710-54X <td> 48x10G + 6x40G <td> FreeScale P2041 <td> Broadcom BCM56854 (Trident2) <td> Yes <td> Yes <td> Yes <td> Yes*** <td> Yes*** <td> No </tr>
<tr> <td> Accton AS6700-32X <td> 32x40G <td> FreeScale P2041 <td> Broadcom BCM56850 (Trident2) <td> Yes <td> Yes <td> Yes <td> No <td> No <td> No </tr>
<tr> <td> Accton AS5712-54X <td> 48x10G + 6x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56854 (Trident2) <td> Yes <td> Yes <td> Yes <td> Yes*** <td> Yes*** <td> No </tr>
<tr> <td> Accton AS6712-32X <td> 32x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56850 (Trident2) <td> Yes <td> Yes <td> Yes <td> Yes*** <td> Yes*** <td> No </tr>
<tr> <td> Accton AS5812-54T <td> 48x10G + 6x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56864 (Trident2+) <td> Yes <td> Yes <td> No <td> No <td> No <td> No </tr>
<tr> <td> Accton AS5812-54X <td> 48x10G + 6x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56864 (Trident2+) <td> Yes <td> Yes <td> No <td> No <td> No <td> No </tr>
<tr> <td> Accton AS6812-32X <td> 32x40G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56864 (Trident2+) <td> Yes <td> Yes <td> No <td> No <td> No <td> No </tr>
<tr> <td> Accton AS7712-32X <td> 32x100G <td> Intel Rangely C2538 x86 <td> Broadcom BCM56960 (Tomahawk) <td> Yes <td> Yes <td> Yes <td> Yes*** <td> Yes*** <td> No </tr>
<tr> <td> Accton Wedge-16X <td> 16x40G <td> Intel Rangely C2550 x86 <td> Broadcom BCM56864 (Trident2+) <td> Work In Progress** <td> Yes <td> No <td> No <td> Yes <td> No </tr>
</table>
DNI/Agema
@@ -43,9 +44,9 @@ DNI/Agema
<table class="table table-striped table-hover">
<thead>
<tr class="info">
<th> Device <th> Ports <th> CPU <th> Forwarding <th> Support Status </tr>
<th> Device <th> Ports <th> CPU <th> Forwarding <th> ONL Certified <th> In Lab <th> ORC <th> OF-DPA <th> OpenNSL <th> SAI </tr>
</thead>
<tr> <td> AG-7448CU <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56845 (Trident) <td> Supported and Tested </tr>
<tr> <td> AG-7448CU <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56845 (Trident) <td> Yes <td> Yes <td> Yes <td> No <td> No <td> No </tr>
</table>
Dell
@@ -53,10 +54,35 @@ Dell
<table class="table table-striped table-hover">
<thead>
<tr class="info">
<th> Device <th> Ports <th> CPU <th> Forwarding <th> Support Status </tr>
<th> Device <th> Ports <th> CPU <th> Forwarding <th> ONL Certified <th> In Lab <th> ORC <th> OF-DPA <th> OpenNSL <th> SAI </tr>
</thead>
<tr> <td> S4810-ON <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56845 (Trident) <td> Supported and Tested </tr>
<tr> <td> S4048-ON <td> 48x10G + 6x40G <td> Intel Atom C2338 <td> Broadcom BCM56854 (Trident2) <td> Supported and Tested </tr>
<tr> <td> S6000-ON <td> 32x40G <td> Intel Atom S1220 <td> Broadcom BCM56850 (Trident2) <td> Supported and Tested </tr>
<tr> <td> S4810-ON <td> 48x10G + 4x40G <td> FreeScale P2020 <td> Broadcom BCM56845 (Trident) <td> Yes <td> Yes <td> Yes <td> No <td> No <td> No </tr>
<tr> <td> S4048-ON <td> 48x10G + 6x40G <td> Intel Atom C2338 <td> Broadcom BCM56854 (Trident2) <td> Yes <td> Yes <td> Yes <td> No <td> No <td> No </tr>
<tr> <td> S6000-ON <td> 32x40G <td> Intel Atom S1220 <td> Broadcom BCM56850 (Trident2) <td> Yes <td> Yes <td> Yes <td> No <td> No <td> No </tr>
<tr> <td> Z9100-ON <td> 32x100G <td> Intel Atom C2538 <td> Broadcom BCM56960 (Tomahawk) <td> Yes <td> Yes <td> No <td> No <td> No <td> No </tr>
</table>
Interface Masters Technologies, Inc.
---
<table class="table table-striped table-hover">
<thead>
<tr class="info">
<th> Device <th> Ports <th> CPU <th> Forwarding <th> ONL Certified <th> In Lab <th> ORC <th> OF-DPA <th> OpenNSL <th> SAI </tr>
</thead>
<tr> <td> Niagara 2948X12XLm <td> 48x10G + 12x40G <td> Intel/AMD x86 <td> Broadcom BCM56850 (Trident2) <td> Work In Progress** <td> No <td> No <td> Yes*** <td> Yes*** <td> No </tr>
<tr> <td> Niagara 2960X6XLm <td> 60x10G + 6x40G <td> Intel/AMD x86 <td> Broadcom BCM56850 (Trident2) <td> Work In Progress** <td> No <td> No <td> Yes*** <td> Yes*** <td> No </tr>
<tr> <td> Niagara 2972Xm <td> 72x10G <td> Intel/AMD x86 <td> Broadcom BCM56850 (Trident2) <td> Work In Progress** <td> Yes <td> No <td> Yes*** <td> Yes*** <td> No </tr>
<tr> <td> Niagara 2932XL <td> 32x40G <td> Intel/AMD x86 <td> Broadcom BCM56850 (Trident2) <td> Work In Progress** <td> No <td> No <td> Yes*** <td> Yes*** <td> No </tr>
<tr> <td> Niagara 2948X6XL <td> 48x10G + 6x40G <td> Intel/AMD x86 <td> Broadcom BCM56850 (Trident2) <td> Work In Progress** <td> No <td> No <td> Yes*** <td> Yes <td> No </tr>
</table>
Notes:
---
ONL Certified means that the system runs ONIE, is able to install a generic version of ONL and has the ONL Platform drivers necessary to manage the system.
\* Systems no longer in the lab cannot be certified post removal
\** Developing ONL Platform Drivers
\*** Vendor provided

16
docs/dev.md Normal file
View File

@@ -0,0 +1,16 @@
==== FIXME ===
Finish this doc
== Adding a new package
* Create most of the files in the 'any' architecture for cross compiling
* Copy the directory structure from an existing package
* APKG.yml goes into the $(ONL)/packages/base/any/foo/ directory
* PKG.yml goes into the $(ONL)/packages/base/$ARCH/foo directory
* Create for each $ARCH you intend to support
* Put code in $(ONL)/packages/base/any/foo/src
* Put package specific Makefiles in $(ONL)/packages/base/any/builds
* Run `make rebuild` in $(ONL)/packages/base/$ARCH/foo to rebuild the package cache
* particularly if you see an error like:
"""ERROR:onlpm:'Package all does not exist.'"""

View File

@@ -35,3 +35,11 @@ export MODULEMANIFEST := $(shell $(BUILDER)/tools/mmg.py --dirs $(ONL) $(ONLPM_O
ONL_MAKE_FLAGS += --no-print-directory -s
ONL_MAKE := $(MAKE) $(ONL_MAKE_FLAGS)
ONL_V_at := @
#
# Some build and autogen tools require these settings.
#
export SUBMODULE_INFRA := $(ONL)/sm/infra
export SUBMODULE_BIGCODE := $(ONL)/sm/bigcode

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -13,7 +13,7 @@ THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(ONL)/make/config.mk
kernel:
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.18.25/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) -j
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.18.25/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) $(ONL_MAKE_PARALLEL)
clean:
rm -rf linux-3.18.25 linux-3.18.25-mbuild

View File

@@ -13,7 +13,7 @@ THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(ONL)/make/config.mk
kernel:
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) -j
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/x86_64-all K_TARGET_DIR=$(THIS_DIR) $(ONL_MAKE_PARALLEL)
clean:
rm -rf linux-3.2.65-1+deb7u2 linux-3.2.65-1+deb7u2-mbuild

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1,2 @@
!include $ONL/packages/base/any/oom-shim/APKG.yml ARCH=amd64 TOOLCHAIN=x86_64-linux-gnu

View File

@@ -0,0 +1,3 @@
include $(ONL)/make/config.amd64.mk
include $(ONL)/packages/base/any/oom-shim/builds/Makefile

View File

@@ -0,0 +1,10 @@
###############################################################################
#
# Inclusive Makefile for the oom_shim module.
#
# Autogenerated 2016-02-16 14:17:39.946619
#
###############################################################################
oom_shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

View File

@@ -47,5 +47,5 @@ GLOBAL_CFLAGS += -DFAULTD_CONFIG_INCLUDE_MAIN=1
GLOBAL_CFLAGS += -DFAULTD_CONFIG_INCLUDE_AIM_MAIN=1
GLOBAL_CFLAGS += -g
GLOBAL_LINK_LIBS += -lpthread
GLOBAL_LINK_LIBS += -lpthread -lrt

View File

@@ -1,6 +1,6 @@
#
# Automatically generated make config: don't edit
# Buildroot 2013.02-rc2-dirty Configuration
# Buildroot 2013.02-rc2-g5e1a5c1-dirty Configuration
#
BR2_HAVE_DOT_CONFIG=y
# BR2_arm is not set
@@ -85,7 +85,7 @@ BR2_HOST_DIR="$(BASE_DIR)/host"
# Mirrors and Download locations
#
BR2_PRIMARY_SITE="$(BUILDROOTMIRROR)"
BR2_PRIMARY_SITE_ONLY=n
BR2_PRIMARY_SITE_ONLY=y
BR2_BACKUP_SITE="https://raw.githubusercontent.com/opennetworklinux/buildroot-download-cache/master/dl"
BR2_KERNEL_MIRROR="http://www.kernel.org/pub/"
BR2_GNU_MIRROR="http://ftp.gnu.org/pub/gnu"
@@ -482,7 +482,11 @@ BR2_PACKAGE_MTD_UBIRMVOL=y
BR2_PACKAGE_MTD_UBIUPDATEVOL=y
# BR2_PACKAGE_NFS_UTILS is not set
# BR2_PACKAGE_NTFS_3G is not set
# BR2_PACKAGE_SQUASHFS is not set
BR2_PACKAGE_SQUASHFS=y
BR2_PACKAGE_SQUASHFS_GZIP=y
# BR2_PACKAGE_SQUASHFS_LZMA is not set
# BR2_PACKAGE_SQUASHFS_LZO is not set
# BR2_PACKAGE_SQUASHFS_XZ is not set
# BR2_PACKAGE_SSHFS is not set
# BR2_PACKAGE_UNIONFS is not set
# BR2_PACKAGE_XFSPROGS is not set

View File

@@ -1,6 +1,6 @@
#
# Automatically generated make config: don't edit
# Buildroot 2013.02-rc2-dirty Configuration
# Buildroot 2013.02-rc2-g5e1a5c1-dirty Configuration
#
BR2_HAVE_DOT_CONFIG=y
BR2_ARCH_IS_64=y
@@ -60,7 +60,7 @@ BR2_HOST_DIR="$(BASE_DIR)/host"
# Mirrors and Download locations
#
BR2_PRIMARY_SITE="$(BUILDROOTMIRROR)"
# BR2_PRIMARY_SITE_ONLY is not set
BR2_PRIMARY_SITE_ONLY=y
BR2_BACKUP_SITE="https://raw.githubusercontent.com/opennetworklinux/buildroot-download-cache/master/dl"
BR2_KERNEL_MIRROR="http://www.kernel.org/pub/"
BR2_GNU_MIRROR="http://ftp.gnu.org/pub/gnu"
@@ -456,7 +456,11 @@ BR2_PACKAGE_MTD_UBIRMVOL=y
BR2_PACKAGE_MTD_UBIUPDATEVOL=y
# BR2_PACKAGE_NFS_UTILS is not set
# BR2_PACKAGE_NTFS_3G is not set
# BR2_PACKAGE_SQUASHFS is not set
BR2_PACKAGE_SQUASHFS=y
BR2_PACKAGE_SQUASHFS_GZIP=y
# BR2_PACKAGE_SQUASHFS_LZMA is not set
# BR2_PACKAGE_SQUASHFS_LZO is not set
# BR2_PACKAGE_SQUASHFS_XZ is not set
# BR2_PACKAGE_SSHFS is not set
# BR2_PACKAGE_UNIONFS is not set
# BR2_PACKAGE_XFSPROGS is not set

View File

@@ -1656,8 +1656,39 @@ CONFIG_USB_NET_DRIVERS=y
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
# CONFIG_USB_RTL8152 is not set
# CONFIG_USB_USBNET is not set
CONFIG_USB_USBNET=y
# CONFIG_USB_NET_AX8817X is not set
# CONFIG_USB_NET_AX88179_178A is not set
CONFIG_USB_NET_CDCETHER=y
# CONFIG_USB_NET_CDC_EEM is not set
CONFIG_USB_NET_CDC_NCM=y
# CONFIG_USB_NET_HUAWEI_CDC_NCM is not set
# CONFIG_USB_NET_CDC_MBIM is not set
# CONFIG_USB_NET_DM9601 is not set
# CONFIG_USB_NET_SR9700 is not set
# CONFIG_USB_NET_SR9800 is not set
# CONFIG_USB_NET_SMSC75XX is not set
# CONFIG_USB_NET_SMSC95XX is not set
# CONFIG_USB_NET_GL620A is not set
CONFIG_USB_NET_NET1080=y
# CONFIG_USB_NET_PLUSB is not set
# CONFIG_USB_NET_MCS7830 is not set
# CONFIG_USB_NET_RNDIS_HOST is not set
CONFIG_USB_NET_CDC_SUBSET=y
# CONFIG_USB_ALI_M5632 is not set
# CONFIG_USB_AN2720 is not set
CONFIG_USB_BELKIN=y
# CONFIG_USB_ARMLINUX is not set
# CONFIG_USB_EPSON2888 is not set
# CONFIG_USB_KC2190 is not set
CONFIG_USB_NET_ZAURUS=y
# CONFIG_USB_NET_CX82310_ETH is not set
# CONFIG_USB_NET_KALMIA is not set
# CONFIG_USB_NET_QMI_WWAN is not set
# CONFIG_USB_NET_INT51X1 is not set
# CONFIG_USB_IPHETH is not set
# CONFIG_USB_SIERRA_NET is not set
# CONFIG_USB_VL600 is not set
# CONFIG_WLAN is not set
#

View File

@@ -1533,7 +1533,7 @@ new file mode 100644
index 0000000..0985c80
--- /dev/null
+++ b/drivers/misc/eeprom/accton_as5812_54t_sfp.c
@@ -0,0 +1,332 @@
@@ -0,0 +1,318 @@
+/*
+ * An hwmon driver for accton as5812_54t sfp
+ *
@@ -1768,20 +1768,6 @@ index 0000000..0985c80
+ return result;
+}
+
+static int convert_cpld_present_value_in_port_order(int value)
+{
+ int ret = 0;
+
+ ret |= (value & BIT_INDEX(0)) << 5;
+ ret |= (value & BIT_INDEX(1)) << 1;
+ ret |= (value & BIT_INDEX(2)) >> 1;
+ ret |= (value & BIT_INDEX(3)) << 1;
+ ret |= (value & BIT_INDEX(4)) >> 4;
+ ret |= (value & BIT_INDEX(5)) >> 2;
+
+ return ret;
+}
+
+static struct as5812_54t_sfp_data *as5812_54t_sfp_update_device(struct device *dev, int update_eeprom)
+{
+ struct i2c_client *client = to_i2c_client(dev);
@@ -1812,7 +1798,7 @@ index 0000000..0985c80
+ dev_dbg(&client->dev, "cpld(0x60) reg(0x22) err %d\n", status);
+ }
+ else {
+ data->status = convert_cpld_present_value_in_port_order(status); /* (u32)status */
+ data->status = status & 0x3F; /* (u32)status */
+ }
+
+ if (update_eeprom) {

View File

@@ -1,3 +1,6 @@
prerequisites:
packages: [ "onlp:$ARCH" ]
common:
arch: $ARCH
version: 1.0.0

View File

@@ -26,6 +26,8 @@ packages:
builds/onlp-platform-defaults/$BUILD_DIR/${TOOLCHAIN}/bin/libonlp-platform-defaults.so : $libdir/
builds/onlpd/$BUILD_DIR/${TOOLCHAIN}/bin/onlpd : $bindir/
init: $ONL/packages/base/any/onlp/src/onlpd.init
changelog: Change changes changes.,

View File

@@ -44,6 +44,8 @@ GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_CTOR_DTOR=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -DONLP_CONFIG_API_LOCK_GLOBAL_SHARED=1
GLOBAL_CFLAGS += -DONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_PVS_SYSLOG=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_DAEMONIZE=1
GLOBAL_CFLAGS += -fPIC
GLOBAL_LINK_LIBS += -lpthread $(LIBONLP_PLATFORM) $(LIBONLP_PLATFORM_DEFAULTS)

View File

@@ -40,8 +40,11 @@ LIBONLP_SO := ../onlp/$(BUILD_DIR)/bin/libonlp.so
GLOBAL_CFLAGS += -DAIM_CONFIG_AIM_MAIN_FUNCTION=onlpdump_main
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MAIN=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_DAEMONIZE=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_PVS_SYSLOG=1
GLOBAL_LINK_LIBS += $(LIBONLP_SO) -Wl,--unresolved-symbols=ignore-in-shared-libs
GLOBAL_LINK_LIBS += -lpthread -lm
GLOBAL_LINK_LIBS += -lpthread -lm -lrt
include $(BUILDER)/targets.mk

View File

@@ -1,21 +1,21 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014, 2015 Big Switch Networks, Inc.
*
*
* Copyright 2014, 2015 Big Switch Networks, Inc.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.eclipse.org/legal/epl-v10.html
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
*
* </bsn.cl>
************************************************************
*
@@ -96,12 +96,17 @@ int onlp_sys_vioctl(int code, va_list vargs);
/**
* @brief Start the platform management thread.
*/
int onlp_sys_platform_manage_start(void);
int onlp_sys_platform_manage_start(int block);
/**
* @brief Stop the platform management thread.
*/
int onlp_sys_platform_manage_stop(void);
int onlp_sys_platform_manage_stop(int block);
/**
* @brief Join the platform management thread.
*/
int onlp_sys_platform_manage_join(void);
/**
* @brief Perform any pending platform management activities.

View File

@@ -1,28 +1,28 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014, 2015 Big Switch Networks, Inc.
#
#
# Copyright 2014, 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.eclipse.org/legal/epl-v10.html
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
#
# </bsn.cl>
############################################################
#
# Local source generation targets.
#
############################################################
include ../../../../init.mk
include $(ONL)/make/config.mk
ucli:
$(SUBMODULE_BIGCODE)/tools/uclihandlers.py onlp_ucli.c

View File

@@ -28,6 +28,10 @@
#include <onlp/sys.h>
#include <onlp/sfp.h>
#include <sff/sff.h>
#include <AIM/aim_log_handler.h>
#include <syslog.h>
static void platform_manager_daemon__(const char* pidfile);
/**
* Human-readable SFP inventory.
@@ -165,10 +169,12 @@ onlpdump_main(int argc, char* argv[])
int x = 0;
int S = 0;
int l = 0;
int M = 0;
char* pidfile = NULL;
const char* O = NULL;
const char* t = NULL;
while( (c = getopt(argc, argv, "srehdojmipxlSt:O:")) != -1) {
while( (c = getopt(argc, argv, "srehdojmM:ipxlSt:O:")) != -1) {
switch(c)
{
case 's': show=1; break;
@@ -180,6 +186,7 @@ onlpdump_main(int argc, char* argv[])
case 'o': o=1; break;
case 'x': x=1; break;
case 'm': m=1; break;
case 'M': M=1; pidfile = optarg; break;
case 'i': i=1; break;
case 'p': p=1; show=-1; break;
case 't': t = optarg; break;
@@ -190,6 +197,11 @@ onlpdump_main(int argc, char* argv[])
}
}
if(M) {
platform_manager_daemon__(pidfile);
exit(0);
}
if(help) {
printf("Usage: %s [OPTIONS]\n", argv[0]);
printf(" -d Use dump(). This is the default.\n");
@@ -200,6 +212,7 @@ onlpdump_main(int argc, char* argv[])
printf(" -x Dump Platform Info only.\n");
printf(" -j Dump ONIE data in JSON format.\n");
printf(" -m Run platform manager.\n");
printf(" -M Run as platform manager daemon.\n");
printf(" -i Iterate OIDs.\n");
printf(" -p Show SFP presence.\n");
printf(" -t <file> Decode TlvInfo data.\n");
@@ -302,10 +315,10 @@ onlpdump_main(int argc, char* argv[])
if(m) {
printf("Running the platform manager for 600 seconds...\n");
onlp_sys_platform_manage_start();
onlp_sys_platform_manage_start(0);
sleep(600);
printf("Stopping the platform manager.\n");
onlp_sys_platform_manage_stop();
onlp_sys_platform_manage_stop(1);
}
if(p) {
@@ -323,3 +336,75 @@ onlpdump_main(int argc, char* argv[])
return 0;
}
#if AIM_CONFIG_INCLUDE_DAEMONIZE == 1
#include <AIM/aim_daemon.h>
#include <AIM/aim_pvs_syslog.h>
#include <signal.h>
#include <errno.h>
void
sighandler__(int signal)
{
onlp_sys_platform_manage_stop(0);
}
static void
platform_manager_daemon__(const char* pidfile)
{
aim_pvs_t* aim_pvs_syslog = NULL;
aim_daemon_restart_config_t rconfig;
aim_daemon_config_t config;
memset(&config, 0, sizeof(config));
aim_daemon_restart_config_init(&rconfig, 1, 1);
AIM_BITMAP_CLR(&rconfig.signal_restarts, SIGTERM);
AIM_BITMAP_CLR(&rconfig.exit_restarts, 0);
rconfig.maximum_restarts=50;
rconfig.pvs = NULL;
config.wd = "/";
aim_daemonize(&config, &rconfig);
aim_log_handler_basic_init_all("onlpd",
"/var/log/onlpd.log",
1024*1024,
99);
if(pidfile) {
FILE* fp = fopen(pidfile, "w");
if(fp == NULL) {
int e = errno;
aim_printf(aim_pvs_syslog, "fatal: open(%s): %s\n",
pidfile, strerror(e));
aim_printf(&aim_pvs_stderr, "fatal: open(%s): %s\n",
pidfile, strerror(e));
/* Don't attempt restart */
raise(SIGTERM);
}
fprintf(fp, "%d\n", getpid());
fclose(fp);
}
/** Signal handler for terminating the platform manager */
signal(SIGTERM, sighandler__);
/** Start and block in platform manager. */
onlp_sys_platform_manage_start(1);
/** Terminated via signal. Cleanup and exit. */
onlp_sys_platform_manage_stop(1);
aim_log_handler_basic_denit_all();
exit(0);
}
#else
static void
platform_manager_daemon__(const char* pidfile)
{
fprintf(stderr, "Daemon mode not supported in this build.");
exit(1);
}
#endif

View File

@@ -228,7 +228,7 @@ onlp_sys_platform_manage_thread__(void* vctrl)
}
int
onlp_sys_platform_manage_start(void)
onlp_sys_platform_manage_start(int block)
{
onlp_sys_platform_manage_init();
@@ -250,22 +250,39 @@ onlp_sys_platform_manage_start(void)
return -1;
}
if(block) {
onlp_sys_platform_manage_join();
}
return 0;
}
int
onlp_sys_platform_manage_stop(void)
onlp_sys_platform_manage_stop(int block)
{
if(control__.eventfd > 0) {
uint64_t zero = 1;
/* Tell the thread to exit */
write(control__.eventfd, &zero, sizeof(zero));
/* Wait for the thread to terminate */
pthread_join(control__.thread, NULL);
if(block) {
onlp_sys_platform_manage_join();
}
}
return 0;
}
int
onlp_sys_platform_manage_join(void)
{
if(control__.eventfd > 0) {
/* Wait for the thread to terminate */
pthread_join(control__.thread, NULL);
close(control__.eventfd);
control__.eventfd = -1;
}
return 0;
}
static int
platform_psus_notify__(void)
@@ -273,6 +290,7 @@ platform_psus_notify__(void)
static onlp_oid_t psu_oid_table[ONLP_OID_TABLE_SIZE] = {0};
static onlp_psu_info_t psu_info_table[ONLP_OID_TABLE_SIZE];
int i = 0;
static int flag[ONLP_OID_TABLE_SIZE] = {0};
if(psu_oid_table[0] == 0) {
/* We haven't retreived the system PSU oids yet. */
@@ -302,6 +320,26 @@ platform_psus_notify__(void)
continue;
}
/* report initial failed state */
if ( !flag[i] ) {
if ( !(pi.status & 0x1) ) {
AIM_SYSLOG_WARN("PSU <id> is not present.",
"The given PSU is not present.",
"PSU %d is not present.", pid);
}
if ( pi.status & ONLP_PSU_STATUS_FAILED ) {
AIM_SYSLOG_CRIT("PSU <id> has failed.",
"The given PSU has failed.",
"PSU %d has failed.", pid);
}
if ((pi.status & 0x01) && !(pi.status & ONLP_PSU_STATUS_FAILED) && (pi.status & ONLP_PSU_STATUS_UNPLUGGED)) {
AIM_SYSLOG_WARN("PSU <id> power cord not plugged.",
"The given PSU does not have power cord plugged.",
"PSU %d power cord not plugged.", pid);
}
flag[i] = 1;
}
/*
* Log any presences or failure transitions.
*/
@@ -363,6 +401,7 @@ platform_fans_notify__(void)
static onlp_oid_t fan_oid_table[ONLP_OID_TABLE_SIZE] = {0};
static onlp_fan_info_t fan_info_table[ONLP_OID_TABLE_SIZE];
int i = 0;
static int flag[ONLP_OID_TABLE_SIZE] = {0};
if(fan_oid_table[0] == 0) {
/* We haven't retreived the system FAN oids yet. */
@@ -392,6 +431,21 @@ platform_fans_notify__(void)
continue;
}
/* report initial failed state */
if ( !flag[i] ) {
if ( !(fi.status & 0x1) ) {
AIM_SYSLOG_WARN("Fan <id> is not present.",
"The given Fan is not present.",
"Fan %d is not present.", fid);
}
if ( fi.status & ONLP_FAN_STATUS_FAILED ) {
AIM_SYSLOG_CRIT("Fan <id> has failed.",
"The given fan has failed.",
"Fan %d has failed.", fid);
}
flag[i] = 1;
}
/*
* Log any presences or failure transitions.
*/

View File

@@ -0,0 +1,67 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: onlpd
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start ONLP Platform Agent
# Description: ONLP PLATFORM AGENTX
### END INIT INFO
PATH=/sbin:/bin:/usr/sbin:/usr/bin
. /lib/lsb/init-functions
DAEMON=/bin/onlpd
PIDFILE=/var/run/onlpd.pid
ONLP_SNMPD_OPTS="-M $PIDFILE"
QUIET=
test -x $DAEMON || exit 5
RUNASUSER=root
UGID=$(getent passwd $RUNASUSER | cut -f 3,4 -d:) || true
case $1 in
start)
log_daemon_msg "Starting ONLP Platform Agent" "onlpd"
if [ -z "$UGID" ]; then
log_failure_msg "user \"$RUNASUSER\" does not exist"
exit 1
fi
start-stop-daemon --start $QUIET --oknodo --pidfile $PIDFILE --startas $DAEMON -- $ONLP_SNMPD_OPTS $ONLP_SNMPD_EXTRA_OPTS
status=$?
log_end_msg $status
;;
stop)
log_daemon_msg "Stopping ONLP Platform Agent" "onlpd"
start-stop-daemon --stop $QUIET --oknodo --pidfile $PIDFILE
log_end_msg $?
rm -f $PIDFILE
;;
restart|force-reload)
$0 stop && sleep 2 && $0 start
;;
try-restart)
if $0 status >/dev/null; then
$0 restart
else
exit 0
fi
;;
reload)
log_daemon_msg "Reloading ONLP Platform Agent" "onlpd"
start-stop-daemon --stop $QUIET --oknodo --pidfile $PIDFILE --signal 1
status=$?
log_end_msg $status
;;
status)
status_of_proc $DAEMON "ONLP Platform Agent"
;;
*)
echo "Usage: $0 {start|stop|restart|try-restart|force-reload|reload|status}"
exit 2
;;
esac

View File

@@ -0,0 +1,32 @@
############################################################
#
# OOM SHIM
#
# Requires: ARCH, TOOLCHAIN
#
############################################################
variables:
libdir: /lib/${TOOLCHAIN}
common:
arch: $ARCH
version: 1.0.0
copyright: Copyright 2016 Big Switch Networks
maintainer: support@bigswitch.com
packages:
- name: oom-shim
version: 1.0.0
summary: Open Optical Module Wrapper library around ONLP
provides: [ oom_shim ]
files:
builds/$BUILD_DIR/${TOOLCHAIN}/bin/liboom-south.so : $libdir/
changelog: Initial code for 2016 OCP Demo

View File

@@ -0,0 +1,56 @@
# -*- Makefile -*-
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
############################################################
include $(ONL)/make/any.mk
MODULE := oom_shim
include $(BUILDER)/standardinit.mk
DEPENDMODULES := AIM onlplib onlp oom_shim cjson cjson_util sff IOF timer_wheel OS
#LIBONLP_PLATFORM_DEFAULTS := ../onlp-platform-defaults/$(BUILD_DIR)/bin/libonlp-platform-defaults.so
#LIBONLP_PLATFORM := ../onlp-platform/$(BUILD_DIR)/bin/libonlp-platform.so
LIBONLP := $(shell $(ONLPM) --find-file onlp:$(ARCH) libonlp.so)
include $(BUILDER)/dependmodules.mk
SHAREDLIB := liboom-south.so
$(SHAREDLIB)_TARGETS := $(ALL_TARGETS)
include $(BUILDER)/so.mk
.DEFAULT_GOAL := sharedlibs
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_CTOR_DTOR=1
GLOBAL_CFLAGS += -DAIM_CONFIG_INCLUDE_MODULES_INIT=1
GLOBAL_CFLAGS += -DONLP_CONFIG_API_LOCK_GLOBAL_SHARED=1
GLOBAL_CFLAGS += -DONLP_CONFIG_INCLUDE_SHLOCK_GLOBAL_INIT=1
GLOBAL_CFLAGS += -fPIC
GLOBAL_LINK_LIBS += -lpthread $(LIBONLP)
include $(BUILDER)/targets.mk
.PHONY: deb
deb:
$(MAKE) -C deb

View File

@@ -0,0 +1,4 @@
include $(ONL)/make/config.mk
MODULE := oom_shim
AUTOMODULE := oom_shim
include $(BUILDER)/definemodule.mk

View File

@@ -0,0 +1,28 @@
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# faultd Autogeneration
#
############################################################
oom_shim_AUTO_DEFS := module/auto/oom_shim.yml
oom_shim_AUTO_DIRS := module/inc/oom_shim module/src
include $(BUILDER)/auto.mk

View File

@@ -0,0 +1,86 @@
############################################################
# <bsn.cl fy=2013 v=onl>
#
# Copyright 2013, 2014 BigSwitch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# faultd Autogeneration Definitions.
#
############################################################
cdefs: &cdefs
- OOM_SHIM_CONFIG_INCLUDE_LOGGING:
doc: "Include or exclude logging."
default: 1
- OOM_SHIM_CONFIG_LOG_OPTIONS_DEFAULT:
doc: "Default enabled log options."
default: AIM_LOG_OPTIONS_DEFAULT
- OOM_SHIM_CONFIG_LOG_BITS_DEFAULT:
doc: "Default enabled log bits."
default: AIM_LOG_BITS_DEFAULT
- OOM_SHIM_CONFIG_LOG_CUSTOM_BITS_DEFAULT:
doc: "Default enabled custom log bits."
default: 0
- OOM_SHIM_CONFIG_PORTING_STDLIB:
doc: "Default all porting macros to use the C standard libraries."
default: 1
- OOM_SHIM_CONFIG_PORTING_INCLUDE_STDLIB_HEADERS:
doc: "Include standard library headers for stdlib porting macros."
default: OOM_SHIM_CONFIG_PORTING_STDLIB
- OOM_SHIM_CONFIG_INCLUDE_UCLI:
doc: "Include generic uCli support."
default: 0
- OOM_SHIM_CONFIG_PIPE_NAME_DEFAULT:
doc: "Default named pipe."
default: "\"/var/run/faultd.pipe\""
- OOM_SHIM_CONFIG_BINARY_SIZE:
doc: "Maximum binary name size."
default: 255
- OOM_SHIM_CONFIG_BACKTRACE_SIZE_MAX:
doc: "Maximum backtrace size."
default: 32
- OOM_SHIM_CONFIG_SERVICE_PIPES_MAX:
doc: "Maximum number of simulatanous service pipes."
default: 8
- OOM_SHIM_CONFIG_BACKTRACE_SYMBOLS_SIZE:
doc: "Maximum backtrace symbols size"
default: 4096
- OOM_SHIM_CONFIG_INCLUDE_MAIN:
doc: "Include faultd_main() for standard faultd daemon build."
default: 0
- OOM_SHIM_CONFIG_INCLUDE_AIM_MAIN:
doc: "Include aim_main() as faultd_main()."
default: OOM_SHIM_CONFIG_INCLUDE_MAIN
- OOM_SHIM_CONFIG_MAIN_PIPENAME:
doc: "Default pipename used by faultd_main() if included."
default: "\"/var/run/faultd.fifo\""
definitions:
cdefs:
OOM_SHIM_CONFIG_HEADER:
defs: *cdefs
basename: faultd_config
portingmacro:
OOM_SHIM:
macros:
- memset
- memcpy
- strncpy
- strlen

View File

@@ -0,0 +1,13 @@
#define MAXPORTS 512
#define SFF_A0_BASE 0x0
#define SFF_A2_BASE 0x100
/**
* SFF_EEPROM_DATA_DEBUG
* For printing the eeprom hex data for debugging.
*/
#ifndef SFF_EEPROM_DATA_DEBUG
#define SFF_EEPROM_DATA_DEBUG 0
#endif

View File

@@ -0,0 +1,6 @@
#ifndef OOM_INTERNAL_H_
#define OOM_INTERNAL_H_
extern void print_block_hex(uint8_t* buf);
#endif

View File

@@ -0,0 +1,230 @@
/******************************
*
* Southbound API definition for
* Open Optical Monitoring (OOM) initiative under the
* umbrella of OCP.
*
* Copyright 2015 Finisar Inc.
*
* LIKELY TO CHANGE, no promises of compatibility with future
* versions is made or implied
*
* Version: 0.4, January 28, 2016 (added oom_get_port(n))
* Author: Don Bollinger
*
*******************************/
#include <stdint.h>
/* Discovery definitions */
/*
* list of valid port types
* Values are from SFF-8436 spec (rev 4.8, page 74)
* note OOM_PORT_TYPE_NOT_PRESENT to indicate no
* module is present in this port
*/
typedef enum oom_port_class_e {
OOM_PORT_CLASS_UNKNOWN = 0x00,
OOM_PORT_CLASS_SFF = 0x01,
OOM_PORT_CLASS_CFP = 0x02,
} oom_port_class_t;
/* Define the elements of a port
* Note: seq_num is an implementation defined magic
* number to detect that the module
* on this port has been removed/inserted since this
* port was last accessed
* port_flags is implementation dependent, for use
* by the underlying NOS and switch
* port_flags should NOT be used or modified by the
* decode layer or above
*/
typedef struct oom_port_s {
void *handle; /* opaque handle for this port */
oom_port_class_t oom_class; /* class is SFF or CFP */
char name[32]; /* 32 bytes for a human readable name */
} oom_port_t;
/*
* get the list of available ports, as an array
* of oom_port_t structs. 'listsize' indicates the
* number of ports that will fit in the portlist[] array.
*
* If there are listsize or fewer ports, and the portlist[]
* array is new or out of date, then the shim populates
* the portlist structure, and returns 0 (success).
*
* If the portlist structure is already current, then the
* shim does not modify portlist[], and returns 1 (no change).
* This is intended as a way to poll for changes to the ports
* (eg modules added, deleted, replaced, etc)
*
* If there are more than listize ports, the shim
* returns -ENOMEM, to indicate that a larger portlist[]
* array is required.
*
* If called as oom_get_portlist(NULL, 0), then the shim will
* return the number of ports, ie the minimum value of listsize. Note
* that some implementations can dynamically add ports, so the return
* value is a very good hint, but not a guarantee as to the required
* size of the portlist[] structure.
*/
int oom_get_portlist(oom_port_t portlist[], int listsize);
/* Read/write control "PINS" function definitions */
/* note that these 'control pins' functions are in limbo right
* now, and may not be implemented until later, if at all.
* Developers of "southbound shims" may choose to delay
* implementation of oom_{get, set}_function()
*/
/* list of functions that can be controlled */
typedef enum oom_functions_e {
OOM_FUNCTIONS_TX_FAULT,
OOM_FUNCTIONS_TX_DISABLE,
OOM_FUNCTIONS_MODULE_ABSENT,
OOM_FUNCTIONS_RS0,
OOM_FUNCTIONS_RS1,
/* more control functions to be defined here */
OOM_FUNCTIONS_RXLOSS_OF_SIG,
OOM_FUNCTIONS_LAST = OOM_FUNCTIONS_RXLOSS_OF_SIG,
OOM_FUNCTIONS_COUNT,
OOM_FUNCTIONS_INVALID = -1,
} oom_functions_t;
/*
* read a function
* rv will be 1 for asserted or enabled, 0 if not
* returns 0 on success, or negative error code
*/
int oom_get_function(oom_port_t* port, oom_functions_t function, int* rv);
/*
* write a function
* value should be 1 for asserted or enabled, 0 if not
* returns 0 on success, or negative error code
*/
int oom_set_function(oom_port_t* port, oom_functions_t function, int value);
/* Read/write EEPROM definitions */
/*
* read EEPROM
* address: the 2-wire (i2c) address, per the SFF specs,
* eg A0h, A2h, A8h, etc. (160, 162, 168 respectively.)
* Note that this address points to 256 bytes of data.
* Bytes 0-127 are intrinsic to this address space.
* Bytes 128-255 are the contents of the "page" selected
* in byte 127. (The page select byte will be written by
* the driver as part of this call. DO NOT explicitly
* set byte 127 to select a page.)
* Thus there are 256 pages (based on one
* byte of page select in byte 127). ONE of these pages
* can be accessed in an EEPROM read, and the content
* of that page will be at offset 128-255 of the address
* space. Page contents starts at offset=128. It is NOT
* necessary to read the first 128 bytes of the address
* space to access the page contents in the second 128
* bytes. See the specs for a further description of
* this access architecture, and the content of each page.
* Note: Bytes 0-127 do not depend on the value of page.
* Reading 256 bytes, starting at offset 0, will read both
* the lower half of the address space, AND the page selected.
* page: page of EEPROM to read from
* offset: byte location within the address space to begin
* transferring data from. Remember, offset 0-127 reference
* the first 128 bytes of "address" range. Their contents
* do not depend on the value of page. Page content begins
* at offset=128.
* len: the number of bytes to be read
* note that (offset + len) must be no more than 256, as
* there are only 256 bytes of data available at A0, A2, etc
* data: receives the memory contents
* returns: the number of bytes read, or a
* negative error code
*/
int oom_get_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data);
/*
* write EEPROM
* address: the 2-wire (i2c) address, per the SFF specs,
* eg A0h, A2h, A8h, etc. (160, 162, 168 respectively.)
* Note that this address points to 256 bytes of data.
* Bytes 0-127 are intrinsic to this address space.
* Bytes 128-255 are the contents of the "page" selected
* in byte 127. (The page select byte will be written by
* the driver as part of this call. DO NOT explicitly
* set byte 127 to select a page.)
* Thus there are 256 pages (based on one
* byte of page select in byte 127). ONE of these pages
* can be accessed in an EEPROM write, and data written
* to that page must be written to offset 128-255 of the
* address space.
* Page contents starts at offset=128. It is NOT
* necessary to write the first 128 bytes of the address
* space to access the page contents in the second 128
* bytes. See the specs for a further description of
* this access architecture, and the content of each page.
* Note: Writes to bytes 0-127 will go to the lower half
* of the address space, and do not depend on the
* value of page. Writing 256 bytes, starting at offset 0,
* will write both the lower half of the address space AND
* the page selected.
* page: page of EEPROM to write to
* offset: byte location within the address space to begin
* transferring data from. Remember, offset 0-127 reference
* the first 128 bytes of "address" range. Their contents
* do not depend on the value of page. Page content begins
* at offset=128.
* len: the number of bytes to be written
* note that (offset + len) must be no more than 256, as
* there are only 256 bytes of address space at A0, A2, etc
* data: data to be written to memory
* returns: the number of bytes written, or a
* negative error code
*/
int oom_set_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data);
/*
* read 16 bit oriented EEPROM
* CFP modules (for example) do not use 2-wire (i2c) addresses
* nor do they use the page table scheme of SFP, XFP, QSFP, etc
* their EEPROM is addressed in 16 bit words, in a 32K word
* linear address space from 8000hex to FFFFhex
* (0000-7FFF are reserved for IEEE 802.3 use)
* the interface below is for these types of modules
* port: an OOM port structure
* address: address between 0x8000 and 0xFFFF to begin read
* Each consecutive address is a 16 bit "register"
* (not an 8 bit byte)
* len: number of 16 bit "registers" to read
* data: receives the memory contents
* returns the number of words read, or a negative error code
*/
int oom_get_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data);
/*
* write 16 bit oriented EEPROM
* CFP modules (for example) do not use 2-wire (i2c) addresses
* nor do they use the page table scheme of SFP, XFP, QSFP, etc
* their EEPROM is addressed in 16 bit words, in a 32K word
* linear address space from 8000hex to FFFFhex
* (0000-7FFF are reserved for IEEE 802.3 use)
* the interface below is for these types of modules
* port: an OOM port structure
* address: address between 0x8000 and 0xFFFF to begin write
* Each consecutive address is a 16 bit "register"
* (not an 8 bit byte)
* len: number of 16 bit "registers" to write
* data: data to be written to memory
* returns the number of words written, or a negative error code
*/
int oom_set_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data);

View File

@@ -0,0 +1,30 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014, 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
#
############################################################
THIS_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
oom_shim_INCLUDES := -I $(THIS_DIR)inc
oom_shim_INTERNAL_INCLUDES := -I $(THIS_DIR)src
oom_shim_DEPENDMODULE_ENTRIES := init:oom_shim ucli:oom_shim

View File

@@ -0,0 +1,30 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014, 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
# Local source generation targets.
#
############################################################
include ../../../../init.mk
ucli:
$(SUBMODULE_BIGCODE)/tools/uclihandlers.py oom_shim_ucli.c

View File

@@ -0,0 +1,29 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014, 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
#
############################################################
LIBRARY := oom_shim
$(LIBRARY)_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
#$(LIBRARY)_LAST := 1
include $(BUILDER)/lib.mk

View File

@@ -0,0 +1,28 @@
/*
* Internal OOM functions
*/
#include <stdio.h>
#include <stdint.h>
void print_block_hex(uint8_t* buf)
{
int j, k;
uint8_t* bufptr8;
uint32_t tempintchar;
bufptr8 = buf;
for (j = 0; j < 8; j++) {
printf(" " );
for (k = 0; k < 19; k++) {
if ((k % 5) == 4) {
printf(" ");
} else {
tempintchar = *bufptr8;
printf("%.2X", tempintchar);
bufptr8++;
}
}
printf("\n");
}
}

View File

@@ -0,0 +1,144 @@
/************************************************************
* <bsn.cl fy=2016 v=onl>
*
* Copyright 2016 Big Switch Networks, Inc.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
* </bsn.cl>
************************************************************
*
*
*
***********************************************************/
#include <errno.h>
#include <onlp/onlp.h>
#include <onlp/sfp.h>
#include <sff/sff.h>
#include <oom-shim/oom-shim.h>
#include <oom-shim/oom_south.h>
/*
* Initializing the SFP and ONLP modules
* compiler calls this function while compiling
*/
void __oom_shim_module_init__(void) {
onlp_init();
}
/*Gets the portlist of the SFP ports on the switch*/
int oom_get_portlist(oom_port_t portlist[], int listsize){
int port,i=0;
oom_port_t* pptr;
onlp_sfp_bitmap_t bitmap;
onlp_sfp_bitmap_t_init(&bitmap);
onlp_sfp_bitmap_get(&bitmap);
if ((portlist == NULL) && (listsize == 0)){ /* asking # of ports */
if(AIM_BITMAP_COUNT(&bitmap) == 0){
return 0;
}
else
return AIM_BITMAP_COUNT(&bitmap);
}
AIM_BITMAP_ITER(&bitmap, port){
int rv;
pptr = &portlist[i];
pptr->handle = (void *)(uintptr_t)port+1;
pptr->oom_class = OOM_PORT_CLASS_SFF;
sprintf(pptr->name, "port%d", port+1);
i++;
rv = onlp_sfp_is_present(port);
if(rv == 0){
/* aim_printf(&aim_pvs_stdout, "module %d is not present\n", port);*/
pptr->oom_class = OOM_PORT_CLASS_UNKNOWN;
continue;
}
if(rv < 0){
aim_printf(&aim_pvs_stdout, "%4d Error %{onlp_status}\n", port, rv);
pptr->oom_class = OOM_PORT_CLASS_UNKNOWN;
continue;
}
}
return 0;
}
int oom_get_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data){
int rv;
unsigned int port_num;
uint8_t* idprom = NULL;
port_num = (unsigned int)(uintptr_t)port->handle;
port_num -= 1;
if (offset >= 256)
return -1; /* out of range */
/**
* place holder implementation until onlp_sfp_eeprom_read()
* can be improved to handle partial page gets
**/
if (address == 0xa0) {
rv = onlp_sfp_eeprom_read(port_num, &idprom);
} else if (address == 0xa2) {
rv = onlp_sfp_dom_read(port_num, &idprom);
} else {
aim_printf(&aim_pvs_stdout, "Error invalid address: 0x%02x\n", address);
return -EINVAL;
}
if(rv < 0) {
aim_printf(&aim_pvs_stdout, "Error reading eeprom: %{onlp_status}\n");
return -1;
}
memcpy(data, &idprom[offset], len);
aim_free(idprom);
return 0;
}
int oom_get_function(oom_port_t* port, oom_functions_t function, int* rv){
//not implemented
return -1;
}
int oom_get_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data){
//not implemented
return -1;
}
int oom_set_memory_sff(oom_port_t* port, int address, int page, int offset, int len, uint8_t* data){
//not implemented
return -1;
}
int oom_set_function(oom_port_t* port, oom_functions_t function, int value){
//not implemented
return -1;
}
int oom_set_memory_cfp(oom_port_t* port, int address, int len, uint16_t* data){
//not implemented
return -1;
}

View File

@@ -0,0 +1,14 @@
###############################################################################
#
# Inclusive Makefile for the oom_shim module.
#
# Autogenerated 2016-02-16 12:05:28.510482
#
###############################################################################
oom_shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
include $(oom_shim_BASEDIR)/module/make.mk
include $(oom_shim_BASEDIR)/module/auto/make.mk
include $(oom_shim_BASEDIR)/module/src/make.mk
include $(oom_shim_BASEDIR)/utest/_make.mk

View File

@@ -0,0 +1,28 @@
############################################################
# <bsn.cl fy=2014 v=onl>
#
# Copyright 2014, 2015 Big Switch Networks, Inc.
#
# Licensed under the Eclipse Public License, Version 1.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.eclipse.org/legal/epl-v10.html
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
# either express or implied. See the License for the specific
# language governing permissions and limitations under the
# License.
#
# </bsn.cl>
############################################################
#
#
#
############################################################
UMODULE := oom_shim
UMODULE_SUBDIR := $(dir $(lastword $(MAKEFILE_LIST)))
include $(BUILDER)/utest.mk

View File

@@ -0,0 +1,131 @@
/************************************************************
* <bsn.cl fy=2014 v=onl>
*
* Copyright 2014, 2015 Big Switch Networks, Inc.
*
* Licensed under the Eclipse Public License, Version 1.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.eclipse.org/legal/epl-v10.html
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*
* </bsn.cl>
************************************************************
*
*
*
***********************************************************/
#include <onlp/onlp_config.h>
#include <onlp/oids.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <AIM/aim.h>
#include <onlp/onlp.h>
#include <onlplib/shlocks.h>
/**
* Base functionality unit tests.
*/
#define __TRY(_prefix, _expr, _suffix) \
do { \
int _rv; \
fprintf(stderr, "%s%s...%s", _prefix, #_expr, _suffix); \
fflush(stderr); \
_rv = _expr ; \
fprintf(stderr, "%s%s...%d\n", _prefix, #_expr, _rv); \
fflush(stderr); \
if(_rv < 0) { \
AIM_DIE("%s%s: failed: %d", #_expr, _rv); \
} \
} while(0)
#define __TRYNR(_prefix, _expr, _suffix) \
do { \
fprintf(stderr, "%s%s...%s", _prefix, #_expr, _suffix); \
fflush(stderr); \
_expr ; \
fprintf(stderr, "%s%s...Done\n", _prefix, #_expr); \
fflush(stderr); \
} while(0)
#define TRY(_expr) __TRY(" ", _expr, "\r")
#define TRYNR(_expr) ___TRYNR(" ", _expr, "\r")
#define TEST(_expr) __TRYNR("", _expr, "\n");
/**
* Test Shared Locks
*/
void
shlock_test(void)
{
onlp_shlock_t* lock = NULL;
TRY(onlp_shlock_create(0xEEEF, &lock, "utest-lock:%d", 1));
TRY(onlp_shlock_take(lock));
TRY(onlp_shlock_give(lock));
TRY(onlp_shlock_take(lock));
TRY(onlp_shlock_give(lock));
TRY(onlp_shlock_global_take());
TRY(onlp_shlock_global_give());
TRY(onlp_shlock_global_take());
TRY(onlp_shlock_global_give());
if(strcmp("utest-lock:1", onlp_shlock_name(lock))) {
AIM_DIE("lock name does not match (%s)", onlp_shlock_name(lock));
}
}
/**
* Test ONIE parsing
*/
void
onie_test(void)
{
/* TODO */
}
int
iter__(onlp_oid_t oid, void* cookie)
{
onlp_oid_hdr_t hdr;
onlp_oid_hdr_get(oid, &hdr);
printf("OID: 0x%x, D='%s'\n", oid, hdr.description);
return 0;
}
#include <onlp/fan.h>
#include <onlp/thermal.h>
#include <onlp/oids.h>
#include <onlp/sys.h>
int
aim_main(int argc, char* argv[])
{
// TEST(shlock_test());
/* Example Platform Dump */
onlp_init();
onlp_platform_dump(&aim_pvs_stdout, ONLP_OID_DUMP_F_RECURSE);
onlp_oid_iterate(0, 0, iter__, NULL);
onlp_platform_show(&aim_pvs_stdout, ONLP_OID_SHOW_F_RECURSE|ONLP_OID_SHOW_F_EXTENDED);
if(argv[1] && !strcmp("manage", argv[1])) {
onlp_sys_platform_manage_start();
printf("Sleeping...\n");
sleep(10);
printf("Stopping...\n");
onlp_sys_platform_manage_stop();
printf("Stopped.\n");
}
return 0;
}

View File

@@ -13,7 +13,7 @@ THIS_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST))))
include $(ONL)/make/config.mk
kernel:
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/powerpc-e500v-all K_TARGET_DIR=$(THIS_DIR) K_COPY_DST=kernel-3.2-deb7-powerpc-e500v-all.bin.gz
$(MAKE) -C $(ONL)/packages/base/any/kernels/3.2.65-1+deb7u2/configs/powerpc-e500v-all K_TARGET_DIR=$(THIS_DIR) K_COPY_DST=kernel-3.2-deb7-powerpc-e500v-all.bin.gz $(ONL_MAKE_PARALLEL)
clean:
rm -rf linux-3.2.65-1+deb7u2 linux-3.2.65-1+deb7u2-mbuild linux-3.2.65-1+deb7u2-dtbs

View File

@@ -24,7 +24,7 @@ KERNEL_DIR := $(ONL)/packages/base/any/kernels/legacy/linux-3.8.13
$(COMPDIR)/kernel-e500mc: $(KERNEL_DIR)/arch/powerpc/configs/$(DEFCONFIG)
mkdir -p $(COMPDIR)/linux-build-e500mc
$(MAKE) -C $(KERNEL_DIR) $(DEFCONFIG) ARCH=powerpc O=$(COMPDIR)/linux-build-e500mc
$(MAKE) -C $(KERNEL_DIR) $(DEFCONFIG) ARCH=powerpc O=$(COMPDIR)/linux-build-e500mc $(ONL_MAKE_PARALLEL)
PATH=$$PATH:$(SWITCHLIGHT)/tools $(MAKE) -C $(KERNEL_DIR) uImage ARCH=powerpc O=$(COMPDIR)/linux-build-e500mc
powerpc-linux-gnu-strip -o $(COMPDIR)/kernel-e500mc $(COMPDIR)/linux-build-e500mc/vmlinux
cp $(COMPDIR)/linux-build-e500mc/vmlinux.bin.gz $(COMPDIR)/kernel-e500mc.bin.gz

View File

@@ -24,7 +24,7 @@ KERNEL_DIR := $(ONL)/packages/base/any/kernels/legacy/linux-3.9.6
$(BUILD_POWERPC_LINUX_85XX)/kernel-85xx: $(KERNEL_DIR)/arch/powerpc/configs/85xx/onl_mpc85xx_defconfig
mkdir -p $(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx
$(MAKE) -C $(KERNEL_DIR) 85xx/onl_mpc85xx_defconfig ARCH=powerpc O=$(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx
$(MAKE) -C $(KERNEL_DIR) 85xx/onl_mpc85xx_defconfig ARCH=powerpc O=$(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx $(ONL_MAKE_PARALLEL)
PATH=$$PATH:$(SWITCHLIGHT)/tools $(MAKE) -C $(KERNEL_DIR) uImage ARCH=powerpc O=$(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx
powerpc-linux-gnu-strip -o $(BUILD_POWERPC_LINUX_85XX)/kernel-85xx $(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx/vmlinux
cp $(BUILD_POWERPC_LINUX_85XX)/linux-build-85xx/vmlinux.bin.gz $(BUILD_POWERPC_LINUX_85XX)/kernel-85xx.bin.gz

View File

@@ -0,0 +1 @@
include $(ONL)/make/pkg.mk

View File

@@ -0,0 +1,2 @@
!include $ONL/packages/base/any/oom-shim/APKG.yml ARCH=powerpc TOOLCHAIN=powerpc-linux-gnu

View File

@@ -0,0 +1,3 @@
include $(ONL)/make/config.powerpc.mk
include $(ONL)/packages/base/any/oom-shim/builds/Makefile

View File

@@ -0,0 +1,10 @@
###############################################################################
#
# Inclusive Makefile for the oom_shim module.
#
# Autogenerated 2016-02-16 14:18:46.799062
#
###############################################################################
oom_shim_BASEDIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))

View File

@@ -98,7 +98,5 @@ class OnlPlatform_x86_64_accton_as7512_32x_r0(OnlPlatformAccton):
self.new_i2c_device('as7512_32x_sfp30', 0x50, 47)
self.new_i2c_device('as7512_32x_sfp31', 0x50, 48)
self.new_i2c_device('as7512_32x_sfp32', 0x50, 49)
]
)
return True

View File

@@ -20,7 +20,7 @@ export PATH="$ONL/tools/scripts:$ONL/tools:$PATH"
# Parallel Make Jobs
# Default parallel build settings
# export MAKEFLAGS="-j64"
export ONL_MAKE_PARALLEL=-j16
# Version files
$ONL/tools/make-versions.py --import-file=$ONL/tools/onlvi --class-name=OnlVersionImplementation --output-dir $ONL/make
@@ -31,7 +31,7 @@ export ONLPM_OPTION_INCLUDE_ENV_JSON="$ONL/make/version-onl.json"
#
# buildroot download mirror. We suggest you setup a local repository containing these contents for faster local builds.
#
export BUILDROOTMIRROR=${BUILDROOTMIRROR:-"http://buildroot.hw.bigswitch.com/dl"}
export BUILDROOTMIRROR=${BUILDROOTMIRROR:-"https://raw.githubusercontent.com/opennetworklinux/buildroot-download-cache/master/dl"}
# These submodules are required for almost everything.
$ONL/tools/submodules.py $ONL sm/infra

View File

@@ -9,7 +9,7 @@ ONL="$(realpath $(dirname $AUTOBUILD_SCRIPT)/../../)"
# Default build branch
BUILD_BRANCH=master
while getopts ":b:s:d:u:p:vc78" opt; do
while getopts ":b:s:d:u:p:vc78r:" opt; do
case $opt in
7)
ONLB_OPTIONS=--7
@@ -32,6 +32,9 @@ while getopts ":b:s:d:u:p:vc78" opt; do
v)
set -x
;;
r)
export BUILDROOTMIRROR=$OPTARG
;;
*)
;;
esac

View File

@@ -506,7 +506,7 @@ class OnlPackageGroup(object):
for bp in buildpaths:
if os.path.exists(bp):
MAKE = os.environ.get('MAKE', "make")
cmd = MAKE + ' -C ' + bp + " " + os.environ.get('ONLPM_MAKE_OPTIONS', "") + target
cmd = MAKE + ' -C ' + bp + " " + os.environ.get('ONLPM_MAKE_OPTIONS', "") + " " + os.environ.get('ONL_MAKE_PARALLEL', "") + " " + target
onlu.execute(cmd,
ex=OnlPackageError('%s failed.' % operation))