2. 2㈜유미테크 TR-069 클라이언트 검토 자료
Modus-TR-069
- Activator
모든 번들은 Activator.java 존재. 역할 : 서비스를 OSGi 서비스 레지스트리에 등록
RPCMethodMngService는 서비스 & 번들 자체적으로 관리함.
public final class Activator implements BundleActivator {
* Start.
* @param context the context
* @throws Exception the exception
*/
public void start(final BundleContext context) throws Exception {
context.addServiceListener(new Scheduler(context, data));
data.setEventFile(context.getDataFile("Events.data"));
context.registerService(RPCMethodMngService.class.getName(),
RPCMethodMng.getInstance(), null);
RPCMethodMng.getInstance().registerRPCMethod("Inform");
RPCMethodMng.getInstance().registerRPCDecoder("InformResponse",
new InformResponseDecoder());
}
/**
* Stop.
* @param context the context
* @throws Exception the exception
*/
public void stop(final BundleContext context) throws Exception {
RPCMethodMng.getInstance().unregisterRPCMethod("Inform");
RPCMethodMng.getInstance().unregisterRPCDecoder("InformResponse");
}
3. 3㈜유미테크 TR-069 클라이언트 검토 자료
Modus-TR-069
- Scheduler
Scheduler는 TR069ClientAPI번들의 Activator를 통해 서비스 등록.
번들 등록시 Scheduler의 startTR69() 자동 동작함.
TR069의 Periodic Inform 메시지 처리 Scheduler임.
private void startTR69() {
if (checkState()) {
Log.info("TR69Client is starting");
// allow discovers root of datamodel
File conf = FileUtil.getFileFromShortName(FileUtil.CONFIG);
if (conf != null) {
InputStream in = null;
try {
Properties properties = new Properties();
// TODO ne pas passer par un fichier de properties
in = new FileInputStream(conf);
properties.load(in);
data.setRoot(properties.getProperty("root"));
} catch (Exception e) {
e.printStackTrace();
}
}
Log.info("Root is " + data.getRoot());
// put the data model structure
model.setData(data);
putDefaultParameter();
Log.debug(data.toString());
// put data into data model
Iterator it = data.getParameterIterator();
Parameter p;
Object value;
while (it.hasNext()) {
p = (Parameter) it.next();
persist.restoreParameterNotification(p.getName());
persist.restoreParameterSubscriber(p.getName());
value = persist.restoreParameterValue(p.getName(),
p.getType());
if (value != null) {
p.setValueWithout(value);
}
}
Log.info(data.toString());
com.setParameterData(data);
com.setRPCMng(RPCMethodMng.getInstance());
it = data.getParameterIterator();
// save data model
while (it.hasNext()) {
p = (Parameter) it.next();
persist.persist(p.getName(), p.getAccessList(),
p.getNotification(), p.getValue(), p.getType());
}
context.registerService(IParameterData.class.getName(), data,
null);
com.setRunning(true);
new Thread(com, "Com Server").start();
ScheduleInform si = new ScheduleInform(data);
si.initParameterSource();
si.createTask();
} else {
if (com != null) {
// stop the com to be clean when is restart
com.setRunning(false);
}
}
}
4. 4㈜유미테크 TR-069 클라이언트 검토 자료
Modus-TR-069
- Scheduler
new Thread(com, "Com Server").start() 으로 시작
객체명 com은 ICom 인터페이스이며 이 구현체는 Com에 구현
com 객체의 역할
TCP및 UDP 소켓을 만들고 포트를 설정
ACS 서버에 접속하며 TR069 세션을 실행
5. 5㈜유미테크 TR-069 클라이언트 검토 자료
- Com
session = new TR69Session(parameterData, rpcMng, retry)
TR69Session
ACS 서버에 접근해 Inform을 보내며 받는 역할
Modus-TR-069
6. 6㈜유미테크 TR-069 클라이언트 검토 자료
Modus-TR-069
- 문제점
Inform을 주고 받는지 확인 어려움
OSGi의 서비스 형태의 구현상 어떠한 인폼을 보내고 받는지 확인 할 방법이
어려움
해결책
디버깅을 위해 실제 서버와 연동해 정상 케이스를 만들고 분석하는게 더욱 빠
른 방법이라고 생각
오픈소스로 된 ACS서버를 찾아 동작시켜 보고자 함
7. 7㈜유미테크 TR-069 클라이언트 검토 자료
jCWMPServer
오픈소스
java이면서 실제 소스를 받을 수 있도록 되어 있는 오픈소스
jCWMPServer (http://sourceforge.net/projects/jcwmpserver/)이 적합
8. 8㈜유미테크 TR-069 클라이언트 검토 자료
jCWMPServer
설치방법
ANT로 build.xml를 실행하여 컴파일된 파일을 만듬.
(빌드 타겟을 jar로 하면 컴파일 및 환경 파일이 복사.)
build 폴더의 serverSettings.xml에 자신의 적합한 환경을 셋팅.
DB 설정
- DB는 MySQL 환경으로 구성되어 있으며 주소 및 디비이름은 하드코딩 되어
있어 소스를 조금 수정 필요.
- server.Database.java의 생성자에 사용자 및 패스워드, 컨넥션 주소 존재
- DB 스키마는 README 파일에 존재
실행
java -jar ./build/jar/ProvisioningServer.jar
9. 9㈜유미테크 TR-069 클라이언트 검토 자료
jCWMPServer
설치시 참고
소스에 script폴더가 존재.
쉘스크립트로 서비스를 실행하고 중지 시키는 스크립트.
환경이 ping 사용자 및 그룹으로 되어 있어야 하고 컴파일된 파일이
/home/ping/build/에 존재해야 함.
이 스크립트를 사용해 보기 위해 환경을 만들어 실행 했지만 데몬 행태로 돌
아가서 java -jar ./build/jar/ProvisioningServer.jar 명령어로 직접 실행.
10. 10㈜유미테크 TR-069 클라이언트 검토 자료
jCWMPServer
Try 1
ACS 서버를 실행하고 TR069 클라이언트를 실행.
IOException 발생.
클라이언트에서 Inform을 보냈지만 서버에서 그대로 무시.
해결
서버쪽 DB의 box 및 model 테이블에 TR클라이언트 환경을 추가해줌.
11. 11㈜유미테크 TR-069 클라이언트 검토 자료
jCWMPServer
Try 2
첫번째 Inform을 서로 주고 받음.
클라이언트 쪽에서 GetParameterValues 부분에서 Invalid arguments 오류 발
생.
서버에서 널포인트 익셉션 발생.
원인
서버에서 단말에 요청할 파라이터를 넣어서 주어야 하는데 요청할 파라미터
가 없음.
해결
해결중...
디비에 직접 요청할 파라미터를 넣으려고 했지만 서버쪽에서 정의하는 데이
터라 정확히 입력이 불가.
따라서 서버가 직접 값을 넣어주는 방식을 선택.
소스를 보면 PHP된 GUI 환경이 존재.
서버를 제어하는 GUI 환경인것 같은데 이걸 설치해 ACS 서버 관리 화면을 띄
우고 이곳에서 파라미터를 넣는 방식으로 해보고자 함.