ONAP Developer Set-Up
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
<proxies> <proxy> <id>evil-corp-http</id> <active>true</active> <protocol>http</protocol> <host>proxy.evil-corp.com</host> <port>599</port> <nonProxyHosts>localhost|127.0.0.1|*.evil-corp.com|*.happy.evil-corp.com|fun.evil-corp.com</nonProxyHosts> </proxy> <proxy> <id>evil-corp-https</id> <active>true</active> <protocol>https</protocol> <host>proxy.evil-corp.com</host> <port>599</port> <nonProxyHosts>localhost|127.0.0.1|*.evil-corp.com|*.happy.evil-corp.com|fun.evil-corp.com</nonProxyHosts> </proxy> </proxies> |
OS Specific Instructions
MAC/OSX (
...
in review under 10.15.7)
Expand |
---|
get your MBP 2016 2020 16 inch ready for development - refer to http://wiki.obrienlabs.cloud/display/DEV/Developer+Guide#DeveloperGuide-OSX Install homebrew package manager -
python should already be installed. - do a --version check install openstack tools install docker (dmg) - https://docs.docker.com/docker-for-mac/install/#download-docker-for-mac |
Redhat/CentOS (
...
in review under RHEL 8.3)
Expand |
---|
...
use the current as of 20180621 17.03 version in the script
https://git.onap.org/logging-analytics/tree/deploy/rancher/oom_rancher_setup.sh
which is
Code Block | ||||
---|---|---|---|---|
| ||||
curl https://releases.rancher.com/install-docker/17.03.sh | sh |
Connecting to ONAP Gerrit
SSH Connection (Recommended)
Log in to the Gerrit host https://gerrit.onap.org/, pull down the menu under your user name (at the extreme top right of the browser window), click on "Settings":
Click your account name on the top right corner of the website and click on Settings.
Add the public ssh key that you created in the previous step.
HTTPS Connection
Expand |
---|
If you choose to use HTTP/HTTPS, you'll need to generate an access password. Log in to the Gerrit host https://gerrit.onap.org/, pull down the menu under your user name (at the extreme top right of the browser window), click on "Settings", and select "HTTP Password" This password may have a limited time to live, so you might get errors like this one: Problem running 'git remote update gerrit' Regenerating a password will most likely solve the connectivity issue. Sometimes, the Gerrit interface on HTTPS might be temporarily faulty, so retries might be needed. |
Proxy setting for IntelliJ and Git (if required)
...
For developers working with a proxy, you might have proxy issues connecting to Linux Foundation website. To avoid the connection issue, you must define the proxy setting for both IntelliJ and Git.
To configure the proxy settings in IntelliJ;
click File -> Settings -> Appearance & Behavior -> System Settings -> HTTP Proxy
enter the correct proxy settings and click Apply.
In case of Manual proxy configuration, while entering the Host name, there is no need to write http:// in front of the URL. For example, if the proxy value is http://one.proxy.com, you would put one.proxy.com as the Host name
To configure the proxy settings for Git, play the following command:
git config --global https.proxy https://<proxy username>:<proxy password>@<proxy url>
git config --global http.proxy http://<proxy username>:<proxy password>@<proxy url>
Note: while entering the proxy username, sometimes it may require to add the domain name in front.
IDEs
Eclipse
Install Eclipse
Download and run the installer from: Install Eclipse. Select "Eclipse IDE for Java Developers" to install.
ONAP Eclipse Java Formatter
Download onap-java-formatter.xml and import into Eclipse.
(updates to the settings should be committed and merged back into the repository)
ONAP uses Google Java Style with some modifications. ( See Java code style )
Expand | ||||||
---|---|---|---|---|---|---|
| ||||||
Using the Eclipse Formatter file above and maven plugin configuration in pom.xml as per pom.xml (https://code.revelc.net/formatter-maven-plugin/ for Eclipse formatter and https://github.com/diffplug/spotless/tree/master/plugin-maven for import order) Code Block | | |||||
|
Add the following option to your MAVEN_OPTS in order not to periodically hang on downloading artifacts in linux | -Djava.net.preferIPv4Stack=true | ||||
enable IP4 forwarding to enable the RHEL VM to act as an edge router - without this docker containers cannot communicate | add to /etc/sysctl.conf | ||||
Install docker (required for some repos like dcae-inventory off dcae
|
Ubuntu (to be reviewed/updated by an Ubuntu user )
...
apt-get update
apt-get install ubuntu-desktop
...
vi /etc/network/interfaces
add
iface enp0s25 inet static
address 192.168.15.101
netmask 255.255.255.0
network 192.168.15.0
broadcast 192.168.15.255
gateway 192.168.15.1
dns-nameservers 8.8.4.4
...
in ~/.ssh/config
Host *
StrictHostKeyChecking no
UserKnownHostsFile=/dev/null
...
Enable non CD repositories so an apt-get update will work
...
sudo passwd root
sudo usermod -U root
sudo reboot now
sudo vi /etc/lightdm/lightdm.conf
[SeatDefaults]
greeter-session=unity-greeter
user-session=ubuntu
greeter-show-manual-login=true
: enable root login
vi /etc/ssh/sshd_config
FROM:
PermitRootLogin prohibit-password
TO:
PermitRootLogin yes
systemctl restart sshd
...
in /etc/environment
-Djava.net.preferIPv4Stack=true
|
Ubuntu (in review under 20.04 )
Expand | |||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Connecting to ONAP Gerrit
SSH Connection (Recommended)
Log in to the Gerrit host https://gerrit.onap.org/, pull down the menu under your user name (at the extreme top right of the browser window), click on "Settings":
Click your account name on the top right corner of the website and click on Settings.
Add the public ssh key that you created in the previous step.
HTTPS Connection
Expand |
---|
If you choose to use HTTP/HTTPS, you'll need to generate an access password. Log in to the Gerrit host https://gerrit.onap.org/, pull down the menu under your user name (at the extreme top right of the browser window), click on "Settings", and select "HTTP Password" This password may have a limited time to live, so you might get errors like this one: Problem running 'git remote update gerrit' Regenerating a password will most likely solve the connectivity issue. Sometimes, the Gerrit interface on HTTPS might be temporarily faulty, so retries might be needed. |
Proxy setting for IntelliJ and Git (if required)
Expand |
---|
For developers working with a proxy, you might have proxy issues connecting to Linux Foundation website. To avoid the connection issue, you must define the proxy setting for both IntelliJ and Git. To configure the proxy settings in IntelliJ; click File -> Settings -> Appearance & Behavior -> System Settings -> HTTP Proxy enter the correct proxy settings and click Apply. In case of Manual proxy configuration, while entering the Host name, there is no need to write http:// in front of the URL. For example, if the proxy value is http://one.proxy.com, you would put one.proxy.com as the Host name To configure the proxy settings for Git, play the following command: git config --global https.proxy https://<proxy username>:<proxy password>@<proxy url> git config --global http.proxy http://<proxy username>:<proxy password>@<proxy url> Note: while entering the proxy username, sometimes it may require to add the domain name in front. |
IDEs
Eclipse
Install Eclipse
Download and run the installer from: Install Eclipse. Select "Eclipse IDE for Java Developers" to install.
ONAP Eclipse Java Formatter
Download onap-java-formatter.xml and import into Eclipse.
(updates to the settings should be committed and merged back into the repository)
ONAP uses Google Java Style with some modifications. ( See Java code style )
Expand | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ||||||||||||||
Using the Eclipse Formatter file above and maven plugin configuration in pom.xml as per pom.xml (https://code.revelc.net/formatter-maven-plugin/ for Eclipse formatter and https://github.com/diffplug/spotless/tree/master/plugin-maven for import order)
The combination can be used in a maven command to rewrite code and imports, then checkstyle audit like so
|
Install useful plugins for Eclipse
...
The combination can be used in a maven command to rewrite code and imports, then checkstyle audit like so
|
Install useful plugins for Eclipse
Install EclEmma for code coverage and SonarLint for static code analysis.
...
Setting up the ONAP Checkstyle for Eclipse
Set "ONAP" configuration in Eclipse
To set the newly built checkstyle files in Eclipse:
- Preferences->Checkstyle
- Click "New"
- Select "External Configuration File"
- Give it a name eg ONAP
- Point at the file <your_git_folder>/oparent/checkstyle/src/main/resources/onap-checkstyle/onap-java-style.xml
(assuming you have downloaded the oparent repo) - Click OK
- Select "ONAP" configuration and click "Set as Default"
- Select "Apply and Close"
Apply "ONAP" configuration to a project in Eclipse
Now we need to activate the checkstyle on one project and set it as the blueprint for all of them:
...
Expand | ||
---|---|---|
|
IntelliJ
Download & Install
see https://www.jetbrains.com/idea/download/#section=windows
...
|
IntelliJ
Download & Install
see https://www.jetbrains.com/idea/download/#section=windows
Make sure you have added the Checkstyle plugin . Follow the below link
https://plugins.jetbrains.com/plugin/1065-checkstyle-idea
Configure ONAP code CheckStyle Plugin for IntelliJ
- Select, File, Settings, Tools, Checkstyle
- Click on + beside the 'Configuration File' box to add a configuration
- Set description to something like 'ONAP Rules'
- Click on Browse to select the file <your_git_folder>/oparent/checkstyle/src/main/resources/onap-checkstyle/onap-java-style.xml
(assuming you have downloaded the oparent repo) - Complete the Wizard (you can set exclusion properties if needed)
- Select the Configuration File you just added by selecting the relevant checkbox
- Click [OK] to close the settings popup
Configure ONAP code style auto formatting for IntelliJ (using the same checkstyle rules and automating it for you )
- Select, File, Settings, ToolsEditor, Checkstyle Code Style
- Click on + beside the 'Configuration File' box to add a configuration
- Set description to something like 'ONAP Rules'
- the gear icon at the end of the line for "Scheme:"
- Optional: As importing a schema overrides the current scheme you might want to first use the 'Duplicate..' and 'Rename...' options to create an easily identifiable scheme e.g. 'ONAP Standard'
- Import Scheme→Checkstyle Configuration
- Click on Browse to select the file <your_git_folder>/oparent/checkstyle/src/main/resources/onap-checkstyle/onap-java-style.xml
(assuming you have downloaded the oparent repo) - Complete the Wizard (you can set exclusion properties if needed)
- Select the Configuration File you just added by selecting the relevant checkbox
- Click [OK] to close the settings popupClick OK
Configure ONAP copyright for IntelliJ
...
- You need to be part of the onap organization in GitHub (see GitHub, click on your icon and select 'My Organizations')
If you are not a member of this organization email support.linuxfoundation.org and ask to be added to the onap organization in GitHub
Note. It is possible to enter a different organization if you at least member of 1 organization (you can create your own in GitHub).
The plugin wizard crashes if you are member of no organization at all, see this Bug: https://jira.sonarsource.com/browse/SLI-426 - Make sure you have added the SonarLint plugin
To use SonarLint with Onap projects you need to setup a connection with SonarCloud
...
- Select, File, Settings, Tools, SonarLint, Project Settings
- Enable (check) 'Binfd Bind project to SonarQube / SonarCloud'
- Select the connection created above using the [Configure the connection] button
- Enter the project name (e.g. 'onap_ccsdk-sli-plugins') or select it using [Search in list..]
- Start typing the name of your project, and it should appear in a list box where it should be selected.
- Click [OK] to finish
...
Install "pip3", if you plan to use git-review.
|
---|
git-review (optional)
In a shell, type the following command (assumes you installed python above) :
...
The component you are working on may require additional tool installations, see the relevant section under Development Guides.
Troubleshooting & Know Issues
...
Expand |
---|
The first issue is that the current ONAP master tagged version of the checkstyle does not work with Eclipse Oxygen/Photon (and maybe other versions) because of the "curly bracket" issue. There is a fix on the way but it's not here yet. The current tagged version of oparent we are using in Policy is 1.2.1. To get around this issue, check out oparent, checked out the 1.2.1 tag, fixed the "curly bracket" bug and built it on my local machine.
|