GithubHelp home page GithubHelp logo

monkey8125 / sonic-mgmt-framework Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sonic-net/sonic-mgmt-framework

0.0 0.0 0.0 5.17 MB

License: Other

Makefile 5.92% Python 37.57% XSLT 1.05% Shell 6.14% Go 31.16% HTML 0.57% C 4.77% C++ 2.50% Mustache 3.17% Jinja 7.15%

sonic-mgmt-framework's Introduction

SONiC Management Framework Repo

Build Instruction

Please note that the build instruction in this guide has only been tested on Ubuntu 16.04.

Pre-rerequisit

User permissions:
`sudo usermod -aG sudo $USER`
`sudo usermod -aG docker $USER`
Packages to be installed:
`sudo apt-get install git docker`

Steps to build and create an installer

  1. git clone https://github.com/project-arlo/sonic-buildimage.git
  2. cd sonic-buildimage/
  3. sudo modprobe overlay
  4. make init
  5. make configure PLATFORM=broadcom
  6. Run the prefetch python script to download all binaries (see below for the script).
  7. To build mgmt-framework container:
    BLDENV=stretch make target/docker-sonic-mgmt-framework.gz
  8. To build Debian Stretch, if not already downloaded:
    BLDENV=stretch make stretch
  9. To build the ONIE installer:
    BLDENV=stretch make target/sonic-broadcom.bin

Faster builds

In order to speed up the process of build, you can prefetch the latest debian files from Azure server, and just build what you need.

Here is a python script you could use to fetch latest prebuilt objects (deb, gz, ko, etc) from SONiC Jenkins cluster:

import os
import shutil
import urllib.request
from html.parser import HTMLParser

UPSTREAM_PREFIX = 'https://sonic-jenkins.westus2.cloudapp.azure.com/job/broadcom/job/buildimage-brcm-all/lastSuccessfulBuild/artifact/'

def get_all_bins(target_path, extension):
    """Get all files matching the given extension from the target path"""
    print('Fetching %s*%s' % (target_path, extension))
    os.makedirs(target_path, exist_ok=True)

    req = urllib.request.urlopen(UPSTREAM_PREFIX + target_path)
    data = req.read().decode()

    class Downloader(HTMLParser):
        """Class to parse retrieved data, match against the given extension,
           and download the matching files to the given target directory"""
        def handle_starttag(self, tag, attrs):
            """Handle only <a> tags"""
            if tag == 'a':
                for attr, val in attrs:
                    if attr == 'href' and val.endswith(extension):
                        self.download_file(val)

        @staticmethod
        def download_file(path):
            filename = os.path.join(target_path, path)
            freq = urllib.request.urlopen(UPSTREAM_PREFIX + target_path + path)

            print('\t%s' % path)
            with open(filename, 'wb') as fp:
                shutil.copyfileobj(freq, fp)


    parser = Downloader()
    parser.feed(data)
    print()

get_all_bins('target/debs/stretch/', '.deb')
get_all_bins('target/files/stretch/', '.ko')
get_all_bins('target/python-debs/', '.deb')
get_all_bins('target/python-wheels/', '.whl')
get_all_bins('target/', '.gz')
Incremental builds

Just clean up the deb's/gz that require re-build, and build again. Here is an exmple:

To build deb file for sonic-mgmt-framework
BLDENV=stretch make target/debs/stretch/sonic-mgmt-framework_1.0-01_amd64.deb-clean
BLDENV=stretch make target/debs/stretch/sonic-mgmt-framework_1.0-01_amd64.deb
To build sonic-mgmt-framework docker alone
BLDENV=stretch make target/docker-sonic-mgmt-framework.gz-clean
BLDENV=stretch make target/docker-sonic-mgmt-framework.gz

sonic-mgmt-framework's People

Contributors

anand-kumar-subramanian avatar faraazbrcm avatar gitsabari avatar gregshpit avatar hpersh-dell avatar kuanyu99 avatar kwangsuk avatar lguohan avatar liushilongbuaa avatar mbalachandar avatar prabhusreenivasan avatar sabareesh-kumar-anandan avatar sachinholla avatar seiferteric avatar tahmed-dev avatar twtseng-tim avatar xumia avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.