scripts/network.js
function createTrafficGroup(bigIp, trafficGroup) {
        let createGroup = true;
        bigIp.list('/tm/cm/traffic-group')
            .then((response) => {
                response.forEach((group) => {
                    if (group.name === trafficGroup) {
                        createGroup = false;
                    }
                });
                if (createGroup) {
                    return bigIp.create(
                        '/tm/cm/traffic-group',
                        {
                            name: trafficGroup,
                            partition: '/Common'
                        }
                    );
                }
                return q();
            })
            .catch((err) => {
                return q.reject(err);
            });
    }
function createTrafficGroup(bigIp, trafficGroup) {
        let createGroup = true;
        bigIp.list('/tm/cm/traffic-group')
            .then((response) => {
                response.forEach((group) => {
                    if (group.name === trafficGroup) {
                        createGroup = false;
                    }
                });
                if (createGroup) {
                    return bigIp.create(
                        '/tm/cm/traffic-group',
                        {
                            name: trafficGroup,
                            partition: '/Common'
                        }
                    );
                }
                return q();
            })
            .catch((err) => {
                return q.reject(err);
            });
    }
Creates a Traffic Group on BigIP, if the Traffic Group does not exist

@param {Object}  bigIp - bigIp client object
@param {String}  trafficGroup - Traffic Group name

@returns {Promise} Promise that will be resolved when Traffic Group is created,
already exists, or if an error occurs.