Thursday, July 6, 2023

Docker and kubernetes setup on centos 9 in virtualbox

 


Home lab simplifies docker and kubernetes installation on centos VMs on virtual box, with the below setup(which needs to be added as below to /etc/hosts on all the nodes):

192.168.56.3 master

192.168.56.4 node01

192.168.56.5 node02

You can modify the network configuration in the network file /etc/NetworkManager/system-connections/enp0s3.nmconnection (as NetworkManager is the way to go network manager from version 9 onwards)

 

1.     Install centos 9 from iso on a virtualbox VM(2GBs RAM and 2 processors) and give it a hostname such as master, which should be accessible by the other VMs and internet access, and also optionally accessible by the host too (for accessing it using putty)


2.  Install docker and start its services:


yum install -y yum-utils git make

yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y

systemctl start docker && systemctl enable docker


3.       Switch off the swap in the master VM and comment out the swap on the /etc/fstab to have the change permanent across reboots:


swapoff -a


4.       Disable firewalld or add exception for the below ports as indicated below:


firewall-cmd --permanent --add-port=6443/tcp

firewall-cmd --permanent --add-port=2379/tcp

firewall-cmd --permanent --add-port=2380/tcp

firewall-cmd --permanent --add-port=10250/tcp

firewall-cmd --permanent --add-port=10259/tcp

firewall-cmd --permanent --add-port=10257/tcp
systemctl reload firewalld.service

5.       Download go lang from https://go.dev/doc/install, extract it and add it to the environment variable PATH


wget https://go.dev/dl/go1.20.5.linux-amd64.tar.gz
tar xvf go1.20.5.linux-amd64.tar.gz
mv go /usr/local/

export PATH=$PATH:/usr/local/go/bin

6.       Clone and build the container runtime (cri-dockerd) following the steps on https://github.com/Mirantis/cri-dockerd (go lang needs to be downloaded, extracted and added to the path environment variable)


git clone https://github.com/Mirantis/cri-dockerd.git
cd cri-dockerd
make cri-dockerd
mkdir -p /usr/local/bin
install -o root -g root -m 0755 cri-dockerd /usr/local/bin/cri-dockerd
install packaging/systemd/* /etc/systemd/system

sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service

systemctl daemon-reload
systemctl enable cri-docker.service
systemctl enable --now cri-docker.socket

7.       Install kubeadm, kubelet and kubectl


cat <<EOF | sudo tee /etc/yum.repos.d/kubernetes.repo

[kubernetes]

name=Kubernetes

baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-\$basearch

enabled=1

gpgcheck=1

gpgkey=https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg

exclude=kubelet kubeadm kubectl

EOF

sudo setenforce 0

sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config

 

sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes

 

sudo systemctl enable --now kubelet

 

8.       Initialize the Kubernetes cluster (this step only in the master):


kubeadm init  --cri-socket unix:///var/run/cri-dockerd.sock --pod-network-cidr=192.168.0.0/24

pay attention to the range 192.168.0.0/24, it should be dedicated to the Kubernetes internal communication, and not the same network used in your VMs normal access network

if you don’t use cri-socket option it will give error that you have multiple runtime and you need to select 1
 of them

output will be something like below:

Your Kubernetes control-plane has initialized successfully!

To start using your cluster, you need to run the following as a regular user:

mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

Alternatively, if you are the root user, you can run:

export KUBECONFIG=/etc/kubernetes/admin.conf

You should now deploy a pod network to the cluster.

Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:

https://kubernetes.io/docs/concepts/cluster-administration/addons/

Then you can join any number of worker nodes by running the following on each as root:

9.       Execute kubectl get nodes to get the below output:


E0706 11:31:19.632061   38975 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused

E0706 11:31:19.632304   38975 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused

E0706 11:31:19.634063   38975 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused

E0706 11:31:19.636012   38975 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused

E0706 11:31:19.638900   38975 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp [::1]:8080: connect: connection refused

The connection to the server localhost:8080 was refused - did you specify the right host or port?


10.   Execute the below commands to get the Kubernetes master running on the NotReady status(this step only in the master):


mkdir -p $HOME/.kube

sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config

sudo chown $(id -u):$(id -g) $HOME/.kube/config

 

11.   Go to https://kubernetes.io/docs/concepts/cluster-administration/addons/ and choose Calico for deploying a network to your cluster, which would lead you finally to the calico project https://docs.tigera.io/calico/latest/getting-started/kubernetes/quickstart (this step only in the master)

12.   Download and execute the command below to add the customer resource definitions (this step only in the master)


wget --no-check-certificate https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/tigera-operator.yaml

kubectl create -f tigera-operator.yaml


13.   Download https://raw.githubusercontent.com/projectcalico/calico/v3.26.1/manifests/custom-resources.yaml and modify cidr value to the used Kubernetes network range(mentioned in step 8 with the flag --pod-network-cidr) (this step only in the master)


content of the file custom-resources.yaml after the modification:




14.   Wait about 3 minutes, use the command kubectl get pods -A and kubectl get nodes -A and you will get the control-plane node ready and all the pods in the running state:






15.   Follow the same steps in the worker nodes exception for the kubeadm command which would be join instead of init as below(this step only in the worker nodes):


kubeadm join 192.168.56.3:6443 --token 4hs3dt.60onfv5nk4lxlz2f  --discovery-token-ca-cert-hash sha256:db3cbc9937a0c9c17ccf0bcf6842326f1d27cecd4caceb8fe006fe19d16435df --cri-socket unix:///var/run/cri-dockerd.sock

wait for around 5 minutes to see all the pods in the Running state and node node01 is in the Ready state

Now you can test create a pod of nginx:

in the master node execute kubectl run nginx -o yaml --image=nginx


Saturday, September 8, 2018

One-To-Many with JSF/Eclipselink using netbeans

Hi,

I am writing this post regarding JSF/Eclipselink JPA using netbeans, although, it is logical and straight forward in netbeans website, but it still has some pitfalls need to be pointed out (and I spent the last two days in one of them although I knew it before).

Let us start demonstrating with simple example in netbeans. In order to create the below example,  you need prerequisites

  • Postgressql jdbc driver as I'm using postgres database
  • Database connection from service tab
  • Jeddict plugin for database modelling(add this to netbeans from tools->plugins->downloaded->add plugins)
Now to the example


  1. create new web application choosing glassfish as your application server and JSF framework
  2. create jdbc connection pool and jdbc resource such as jdbc/example JNDI
  3. using jeddict create Jpa Modeler 
  4. drag and drop entities 
  5. put the required names, attributes and relationships
  6. go to the project and create a persistence unit selecting the JNDI you created earlier
  7. copy the persistence unit name to the properties of the diagram and save
  8. right click on the Jpa Modeler screen and click on Generate Source Code, then put entity in the Package name then click on Generate
  9. right click on the project and JSF Pages from Entity Classes, name Session Bean Package facade and JSF Classes Package entity.domain
  10. Now you will have all the controllers/Managed Beans and EJBs/Session Beans in addition to the entities which were created already in the previous step, in addition to the jsf pages for all the entities CRUD operations
  11. NOW, pay attention to the pitfalls so you application works correctly,
  • all entities will not be serializable by default neither have (no argument constructor) nor (equals and hashcode functions), WHICH are must in order to have your application works properly.
Optional, when you create the departments and navigate to employees to create employee, you will find drop down list looks like the snapshot, and you can rectify this using toString() in the respective entity which is Department here

Troubleshooting few issues:
  • Sometime the application doesn't work properly if you have already created tables with the same name but not the same attributes before, and you can fix it by making the persistence as Drop and Create, then Clean and Compile and Run. DON'T forget to return the persistence back it to Create.
  • Sometimes you face issue of "Unreachable, identifier 'departmentController' resolved to null" for example which can be solved by restarting the glassfish.




Wednesday, August 15, 2018

JSF ManyToMany application tips

Hello,

As many of you know that you can use netbeans in an extremely efficient way to deploy your application entities, backing beans, facade (session beans) and even pages for CRUD operations using "JSF Pages from Entity Classes" or "PrimeFaces Pages frin Entity Classes".

However, this works perfectly when you are using the second (PrimeFaces one) while it doesn't in the first (JSF one).

JSF works well with OneToMany relationships while it doesn't (automatically creating h:selectManyListbox for example) in the ManyToMany relationships. So, you find yourself have to create (h:selectManyListbox) manually and it will not work as you would have the same classic conversion issue from String to List of Objects. In order to get around this you can follow the below simple way.

Create your multiple options control code,

<h:selectManyListbox value="#{furnitureController.materials}">
<f:selectItems value="#{materialController.findAll()}" 
var="c"
itemLabel="#{c.material}" 
itemValue="#{c.id}" />
</h:selectManyListbox >

create the findAll() method in the controller materialController to retrieve the list of the options to you

public List<Material> findAll() {
        return ejbFacade.findAll();
}

Add list of string variable, setter and getter in the controller  furnitureController to hold the primary key values until processing.

private List<String> materials;

    public List<String> getMaterials() {
        return materials;
    }

    public void setMaterials(List<String> materials) {
        this.materials = materials;
    }

Lastly, update the create method with the following code BEFORE the getFacade().create(current);
to loop on the list of IDs and add sub objects to the main object and therefore associate them together in the joined table.

for (String id : materials) {
          current.addMaterial(materialFacade.find(Long.parseLong(id)));
}

Tuesday, July 31, 2018

Using Pdfbox to fill PDF template with data which might be in Arabic

Hello,

In my previous post I shared how we can create a pdf and write in Arabic in it.

However, in many cases there is a need to fill a pdf template with data and that is prone to mistakes, time consuming and boring too. So, in order to rectify this it is better to keep the data in a database and generate the form pre-populated with the static data then worry about adding the additional data only.

Prerequisites:
-pdfbox v.2.0.11
-ICU v.62
-arial.ttf

You can download pdfbox-app-2.0.11.jar which is the latest as of the time I am writing this post from here.

You can download ICU from here

Download arial.ttf from here

Go to netbeans or the IDE you are using and them to your Libraries and create the below desktop program.

package pdftester;

import com.ibm.icu.text.ArabicShaping;
import com.ibm.icu.text.ArabicShapingException;
import java.io.File;
import java.io.IOException;
import org.apache.fontbox.ttf.TrueTypeFont;
import org.apache.pdfbox.cos.COSName;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDResources;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDTrueTypeFont;
import org.apache.pdfbox.pdmodel.font.PDType0Font;
import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;
import org.apache.pdfbox.pdmodel.interactive.form.PDTextField;

public class PDFtester {

    public static void main(String[] args) throws IOException, ArabicShapingException {

        PDDocument doc = PDDocument.load(new File("c:\\data\\letters\\letter.pdf"));
        PDAcroForm acroForm = doc.getDocumentCatalog().getAcroForm();
        PDResources formResources = acroForm.getDefaultResources();

        PDType0Font font = PDType0Font.load(doc, new File("C:\\data\\arial.ttf"));

        formResources.put(COSName.getPDFName("F0"), font);
        String s = "نحن معشر الانبياء امرنا ان نخاطب الناس على قدر عقولهم";
        PDTextField formField = (PDTextField) acroForm.getField("15");
        formField.setDefaultAppearance("/F0 0 Tf 0 g");
        formField.setValue(new StringBuilder(new ArabicShaping(ArabicShaping.LETTERS_SHAPE).shape(s)).reverse().toString());

        doc.save("c:\\data\\letters\\filling.pdf");
        doc.close();
    }
}


There is a small glitch in the pdf document which that when you click inside the field letters are getting disconnected and style converts into LTR (Left to Right). I am working on figuring the issue, but the pdf is printable and it will work fine.

Monday, July 30, 2018

Using Java and Pdfbox to create PDF with Arabic text

Hello,

I am writing this post to demonstrate how to create pdf file using pdfbox library, more importantly how to write in Arabic in it which is not very common topic people talk about.

Simply, the below represents the code to do that, and depending on your scenario you can dig more on the rest of the library, it is open source and very rich.

Prerequisites:
-pdfbox v.2.0.11
-ICU v.62
-arial.ttf

You can download pdfbox-app-2.0.11.jar which is the latest as of the time I am writing this post from here.

You can download ICU from here

You can download arial.ttf from here and put it in c:\data\ for the example to work

Go to netbeans or the IDE you are using and them to your Libraries and create the below desktop program.

package pdftester;

import com.ibm.icu.text.ArabicShaping;
import com.ibm.icu.text.ArabicShapingException;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.pdmodel.PDPage;
import org.apache.pdfbox.pdmodel.PDPageContentStream;
import org.apache.pdfbox.pdmodel.font.PDFont;
import org.apache.pdfbox.pdmodel.font.PDTrueTypeFont;
import org.apache.pdfbox.pdmodel.font.PDType0Font;

public class PDFtester {

    public static void main(String[] args) {

        PDDocument doc = new PDDocument();
        PDPage page = new PDPage();
        doc.addPage(page);
        PDPageContentStream pageContentStream;
        try {
            pageContentStream = new PDPageContentStream(doc, page);
            pageContentStream.beginText();
            pageContentStream.setFont(PDType0Font.load(doc, new File("c:\\data\\arial.ttf")), 20);
            pageContentStream.newLineAtOffset(250, 750);
            String s = "سامر احمد";
            pageContentStream.showText(new StringBuilder(new ArabicShaping(ArabicShaping.LETTERS_SHAPE).shape(s)).reverse().toString());
            pageContentStream.endText();
            pageContentStream.close();
            doc.save("c:\\data\\test.pdf");
            doc.close();
        } catch (IOException ex) {
            Logger.getLogger(PDFtester.class.getName()).log(Level.SEVERE, null, ex);
        } catch (ArabicShapingException ex) {
            Logger.getLogger(PDFtester.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

Monday, April 9, 2018

Rest API using python

In this post I would like to share my experience with Rest APIs using python as a consumer, this will be very useful and innovative in term of operation and automation.

Most of the time system (Storage, UNIX, Windows, Network) admins complain about the amount of work, many repetitive tasks are done in a tedious way, critical mistakes can happen due to doing many tasks at the same time. Apart from all that, recently the self service approach started to rise as a way to offload the tasks to the end user, budget control and reducing interactions. Also not to forget to mention the agility of the environment which will involve the swift creation and removal of environments.

Probably, all of what mentioned above is doable in UNIX and Windows servers, if not most of them. Now, but what about appliances, such as switches, storage, and any embedded systems. Recently, all new well supported systems started to come with enabled Rest APIs, to facilitate integration with other systems, reporting and monitoring.

Using Rest APIs of specific system will have few requirements:
  • Understanding HTTP requests
  • Understanding JSON/XML data
  • Programming language (Python) with request module installed
  • Documentation of how to use the system Rest API
Briefly, the HTTP requests are revolving around GET, POST, PUT, DELETE, UPDATE and some other types which we don't require usually in our Rest API operations. GET is used for list/retrieving objects, POST for creation of objects, PUT for updating attributes, UPDATE for updating the objects and intuitively DELETE for deleting objects.

Object here represents element to be Listed, Created or Deleted..etc. as per the above type of requests.

Security is important element in the Rest APIs that is why there are couple of ways to secure Restful resources. Github for example is using Basic Authentication, OAuth2 token and OAuth2 key/secret check here for more information.

Basic authentication is the usual used Rest API security method, which is basically Username and Password concatenated with ":" in the middle, and prepended by "Basic " passed in a base64 encrypted format.

Here is how you can demonstrate the use of base64 encoding (you don't need to do this in your code as HTTP protocol will do this automatically in the background) and how it will look like in the header parameters:

I am using python version 3.x

#!/usr/bin/python3.6

import base64
import sys

print (base64.b64encode("user:pass".encode()).decode())


The HTTP will have the below parameter in the request header:
KeyValue
AuthorizationBasic dXNlcjpwYXNz

You can use google chrome plugin called Postman to troubleshoot or debug your requests.

Now, starting to make GET requests (without authentication) is easy by following few steps in github..

#!/usr/bin/python3.6

import json
import requests
requests.packages.urllib3.disable_warnings()

response = requests.get('https://api.github.com/users', verify=False)
json_data = json.loads(response.text)
print(json_data)

The above code will get you the list of users in github in json format, you can use online json formatter to view it in a readable format.

Similarly, we can use this to interact with EMC VPLEX:

#!/usr/bin/python3.6

import requests, json

requests.packages.urllib3.disable_warnings()

url = "https://Cluster_IP/vplex/clusters/Cluster_ID/virtual-volumes/*"
payload = (UsernamePassword)
r = requests.get(url, auth = payload, verify = False) #make get request passing the credentials
data = json.loads(r.text) #read response as json and data will be a dictionary variable
print(data) #printing data
print(json.dumps(data)) #printing will be in a nice readable format

Using Rest API I developed interface for deleting VPLEX volumes, which takes less than a minute. This task used to take 15 to 30 minutes using CLI(which was the only available way to delete the volume). Therefore, the productivity significantly increased, and this way can help in automating provisioning and destroying Demo environments, which is the current trend in demonstrating new technologies.

Tuesday, May 30, 2017

adding bulk of users GUI interface using Java swing in windows

Now, continuing talking about providing GUI interface to systems operations.

We will dive more into Java and start using the jar file command-factory.jar I mentioned in my previous article to show how useful is to provide GUI interface whether it's for delegation, e.g. you want to delegate specific operation, give access to specific team to extract report(from system not database), enforce standards for the operations conventions/unifying passwords, integrate multiple services together..etc, the list is too long to be mentioned here.

To demonstrate the idea, I will use what I would like to call OAM Object-Administrational Mapping (I just invented that ^_^) which is equivelant to the ORM Object-Relational Mapping. So, I will use command-factory.jar to create small app as "helloworld" to demonstrate the idea of "extending administration capabilities using Java development".

Let us start, after googling for 10 minutes I found the commands to create and delete windows user(normal windows user not a domain user).

in windows cmd:

-net user USERNAME PASSWORD /add

e.g.

-net user testuser Pass_123 /add

to delete:

net user testuser /del

Keep in mind in windows this works in the external commands only(check windows internal vs. external commands), for internal commands it didn't work I guess you need to use "shell" flag somewhere, Windows Powershell or even write python script to do the job for you. Even though with the external commands, probably you will need to use the full executable path (just put the full path it will save you some head scratches).

in windows cmd:

where net

output:
C:\Windows\System32\net.exe

After becoming familiar with the command, go to your IDE netbeans, eclipse..etc. Here, I thought it is better to demonstrate with desktop app instead of web based as it is faster to be used, you know, web app needs application server.

We will follow MVC design pattern which will include Model(user class/entity), View (main console/java swing) and controller(java class to link model and view).

create Java desktop application and give it a name call it UserManager for example, and for the sake of testing we will create main class without GUI/swing. Once application is created add command-factory.jar to the project libraries.


Project includes:

-User.java

package entity;

public class User {
 
    private String name;
    private String password;

    public User() {
    }

    public User(String name, String password) {
        this.name = name;
        this.password = password;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "User{" + "name=" + name + ", password=" + password + '}';
    }  
}

-Controller.java
package controller;

import UserSAO.UserSAO;
import entity.User;

public class Controller {

    private UserSAO userSAO;
    private User user;

    public Controller() {
        userSAO = new UserSAO();
    }

    public UserSAO getUserSAO() {
        return userSAO;
    }
}

-UserSAO.java

package UserSAO;

import commandfactory.CommandFactory;
import entity.User;
import java.util.ArrayList;
import java.util.List;

public class UserSAO {

    CommandFactory commandFactory;

    public CommandFactory getCommandFactory() {
        return commandFactory;
    }

    public void createUser(User user) {
        List<String> cmd = new ArrayList<>();
        cmd.add("C:\\Windows\\System32\\net.exe");
        cmd.add("user");
        cmd.add(user.getName());
        cmd.add(user.getPassword());
        cmd.add("/add");
        commandFactory = new CommandFactory();
        commandFactory.setCmdList(cmd);
        commandFactory.execCommand();
    }

    public void deleteUser(String name) {
        List<String> cmd = new ArrayList<>();
        cmd.add("C:\\Windows\\System32\\net.exe");
        cmd.add("user");
        cmd.add(name);
        cmd.add("/delete");
        commandFactory = new CommandFactory();
        commandFactory.setCmdList(cmd);
        commandFactory.execCommand();
    }
}

-Main.java

package usermanager;

import controller.Controller;
import entity.User;

public class Main {

    public static void main(String[] args) {

        User user = new User("testuser", "Pass_123");
        Controller controller = new Controller();
        controller.getUserSAO().createUser(user);
        if (controller.getUserSAO().getCommandFactory().getExitCode() == 0) {
            System.out.println(controller.getUserSAO().getCommandFactory().getStdOutPut());
        }
//        controller.getUserSAO().deleteUser("testuser");
//        if (controller.getUserSAO().getCommandFactory().getExitCode() == 0) {
//            System.out.println(controller.getUserSAO().getCommandFactory().getStdOutPut());
//        }
    }
}


The code above is to create a user with password (testuser/Pass_123). To delete a user, you can use the below..

-Main.java

package usermanager;

import controller.Controller;

public class Main {

    public static void main(String[] args) {

//        User user = new User("testuser", "Pass_123");
        Controller controller = new Controller();
//        controller.getUserSAO().createUser(user);
//        if (controller.getUserSAO().getCommandFactory().getExitCode() == 0) {
//            System.out.println(controller.getUserSAO().getCommandFactory().getStdOutPut());
//        }
        controller.getUserSAO().deleteUser("testuser");
        if (controller.getUserSAO().getCommandFactory().getExitCode() == 0) {
            System.out.println(controller.getUserSAO().getCommandFactory().getStdOutPut());
        }
    }
}

Now, I will replace the main class with java swing class and have it so basic to accept user names in TextArea component then create users based on that along with their passwords..

-create JFrame class call it MainFrame

-from swing palette just add by drag and drop two text areas and 2 labels and 1 button
-Declare as instance variable and initialize it in the constructor

Controller controller;
public MainFrame() {
controller = new Controller();
..omitted

it will look like the snapshot

In the actionevent of the Add command you will add the below code

  for (String s: userTextArea1.getText().split("\\n+")) {
            controller.getUserSAO().deleteUser(s);
            if (controller.getUserSAO().getCommandFactory().getExitCode() == 0)
            logArea.append(s+" user is deleted\n");
        }

on windows cmd:
-net user (to check users were created)

while in the action event of Delete command you will put the below code

for (String s: userTextArea1.getText().split("\\n+")) {
            controller.getUserSAO().deleteUser(s);
            if (controller.getUserSAO().getCommandFactory().getExitCode() == 0)
            logArea.append(s+" user is deleted\n");
        }


after creation
-net user (to check users)
after deletion
-net user



jar url https://github.com/samir82show/devops/blob/master/Usertest.zip
use java 8
Samir